Linux USES the init command to shutdown restart and switch modes

  • 2020-05-27 07:56:39
  • OfStack

Linux init command details

reboot may be a command known to everyone who has used Linux, but one command, "init," is the elite command.

Recently, a colleague learned to install CentOS. What he installed was a system with a desktop, but when he started it, he entered the command line mode. He was confused and asked me, so I executed "init 5" once, and the interface came out. In fact, the computer this thing is like this, not good feeling magic, when you can, that is the thing.

Linux has a file /etc/inittab

# inittab    This file describes how the INIT process should set up  
#        the system in a certain run-level.  
# Author:    Miquel van Smoorenburg, <>  
#        Modified for RHS Linux by Marc Ewing and Donnie Barnes  
# Default runlevel. The runlevels used by RHS are:  
#  0 - halt (Do NOT set initdefault to this)  
#  1 - Single user mode  
#  2 - Multiuser, without NFS (The same as 3, if you do not have networking)  
#  3 - Full multiuser mode  
#  4 - unused  
#  5 - X11  
#  6 - reboot (Do NOT set initdefault to this)  



0 is turned off
1 is a single user
2 is multi-user, not connected to the Internet
3 is multiple users
4 is not used
The 5 is xwindows, which means it has an interface
Six is to restart


The init command is simple. Enter init + the mode you want and press enter.

For example, input: init 0 is shutdown

init 3 is all about switching to multiple users
init 5 is about switching to the interface
init 6 is a reboot

Thank you for reading, I hope to help you, thank you for your support of this site!

Related articles: