O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

init

Synopsis

                  init [bootflags] [runlevel]

System administration command. Initialize system.

Boot flags

-a

Set the AUTOBOOT environment variable to yes. The boot loader will do this automatically when booting with the default command line.

-b

Boot directly into a single user shell for emergency recovery.

-z characters

The specified characters are ignored, but will make the command line take up a bit more room on the stack. init uses the extra space to show the curent runlevel when running the ps command.

Files

init is the first process run by any Unix machine at boot time. It verifies the integrity of all filesystems and then creates other processes, using fork and exec, as specified by /etc/inittab. Which processes may be run are controlled by runlevel. All process terminations are recorded in /var/run/utmp and /var/log/wtmp. When the runlevel changes, init sends SIGTERM and then, after 20 seconds, SIGKILL to all processes that cannot be run in the new runlevel.

Runlevels

The current runlevel may be changed by telinit, which is often just a link to init. The default runlevels vary from distribution to distribution, but these are standard:

0

Halt the system.

1, s, S

Single-user mode.

6

Reboot the system.

q, Q

Reread /etc/inittab.

Check the /etc/inittab file for runlevels on your system.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required