init command: switch system runlevel
init command Function Description
The init command toggles the system runlevel. init defines seven runlevels, where init 0 is used to shutdown and init 6 is used to restart the computer.
init command Syntax
init [Option]
Option Meaning
The meaning of each option in the command is shown below.
Option | Description |
---|---|
–verbose | Output detailed emission information about job status changes and events to the system console or log |
init command Demo
Shutting down the computer system
[root@deepinout ~]# init 0 //Switching to runlevel 0 is equivalent to shutting down the system
Rebooting the computer system
[root@deepinout ~]# init 6 //Switching to runlevel 6 is equivalent to rebooting the system
What exactly is the runtime level?
Simply say, the runlevel is the level of functionality that the operating system is currently running at.
This level ranges from 0 to 6 and has different functions. You can also see the English description of it in /etc/inittab
.
#0 Shutdown (never set initdefault to 0)
#1 Single User Mode
#2 Multi-user moe, no NFS (similar to level 3, which stops some services)
#3 Full multi-user mode
#4 Not used
#5 x11(Xwindow)
#6 Reboot (never set initdefault to 6)