Is Viewing System Files Like "/Sbin/Init" Safe?

Is Viewing System Files Like "/Sbin/Init" Safe?

Do I risk breaking my installation of Ubuntu if I view /sbin/init without editing it, say, in gedit? (I'm taking an online Linux course and they mention this and I wanted to see what it looks like.)

2

4 Answers

Yes. It's safe to view any system file(s), especially if you don't use sudo or root.

prakhar@aS4v4g3wOrld:~$ ll /sbin/init
-rwxr-xr-x 1 root root 265848 Jul 18 15:16 /sbin/init*

The owner of /sbin/init is root. The only way you can modify this file is either via logging as root ($ sudo -s) or by giving an editor superuser permissions using sudo.

Besides, /sbin/init is a binary file, not meant for reading. If you still want to view this, use a hex editor like

$ sudo apt-get install ghex
$ ghex /sbin/init

Sure, you can read it without doing any harm.

It's a binary file - if you are interested in the text in it, like program symbols, messages, or version numbers, use strings:

strings /sbin/init | less

/lib64/ld-linux-x86-64.so.2
I*|YB
GU1q
nx#$
BDCE
#9ym
libnih.so.1
_ITM_deregisterTMCloneTable
__gmon_start__
_Jv_RegisterClasses
_ITM_registerTMCloneTable
nih_watch_new
nih_alloc_real_set_destructor
nih_timer_add_timeout
[ ... many more lines ... ]

To see the full binary content of the file in a somewhat readable form, use hexdump:

hexdump -C /sbin/init | less

00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00  |.ELF............|
00000010  03 00 3e 00 01 00 00 00  e9 96 00 00 00 00 00 00  |..>.............|
00000020  40 00 00 00 00 00 00 00  78 07 04 00 00 00 00 00  |@.......x.......|
00000030  00 00 00 00 40 00 38 00  09 00 40 00 1c 00 1b 00  |....@.8...@.....|
00000040  06 00 00 00 05 00 00 00  40 00 00 00 00 00 00 00  |........@.......|
00000050  40 00 00 00 00 00 00 00  40 00 00 00 00 00 00 00  |@.......@.......|
00000060  f8 01 00 00 00 00 00 00  f8 01 00 00 00 00 00 00  |................|
00000070  08 00 00 00 00 00 00 00  03 00 00 00 04 00 00 00  |................|
00000080  38 02 00 00 00 00 00 00  38 02 00 00 00 00 00 00  |8.......8.......|
00000090  38 02 00 00 00 00 00 00  1c 00 00 00 00 00 00 00  |8...............|
000000a0  1c 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
000000b0  01 00 00 00 05 00 00 00  00 00 00 00 00 00 00 00  |................|
000000c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000d0  1c d7 03 00 00 00 00 00  1c d7 03 00 00 00 00 00  |................|
[ ... many more lines ... ]

You can view but you can't make changes. Do not save on exit init. copy the file first with

cp /sbin/init /sbin/init.me

then run

sudo nano /sbin/init.me

Here you first make a copy of the original file (init.me) then you take a look at init.me and find out what you are searching for.

1

Yep, it is fine to just view. Make sure when you click close, you don't save any changes you accidentally made.

To be super safe, run the following command:

sudo cp /sbin/init /tmp/init.copy

then run:

sudo gedit /tmp/init.copy

So you're not viewing the original.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.