The init
command allows you to set what is called the current system runlevel.
All Linux machines have seven runlevels, which are responsible for managing certain system actions and behaviors. On a classical SystemV installation, each runlevel would be part of the boot procedure:
- Runlevel 0 (Machine off)
- Runlevel 1 (Singleuser / Diagnostics Mode)
- Runlevels 2-4 (Bootup and service start)
- Runlevel 5 (Fully booted system, all services online)
- Runlevel 6 (Going down for restart)
The init
(and telinit
) commands allow you to specify what runlevel to move init and the system to.
Note, however, that the entire runlevel concept is now a bit antiquated due to the creation of the service model (through Upstart and systemd (service apache2 start
)), and should be considered deprecated in favor of using proper systemd commands.
Using runlevels now runs the risk of terminating essential services, so it is often advised to not use the init
or telinit
commands.