In Linux systems, we generally use the following four methods to shut down. The differences between them are as follows:
1. shutdown command
The shutdown command is used to safely shut down the Linux system.
When executing the shutdown command, the system will notify all logged-in users that the system will be shut down, and the login command will be frozen, that is, new users can no longer log in to the system. Use the shutdown command to shut down the system directly, delay the shutdown for a specified time, or restart the system. Delaying the system shutdown for a specified period of time allows the user time to save files currently being processed and close open programs.
Some parameters of the shutdown command are as follows:
[-t] Specify how long to shut down the system after
[-r] Restart the system
[ -k] does not actually shut down, but only sends a warning signal to each logged-in user
[-h] Shut down the system (halt)
2, halt command
halt is the simplest shutdown command, which actually calls the shutdown -h command. When halt is executed, the application process is killed and the kernel is stopped after the file system write operation is completed.
Some parameters of the halt command are as follows:
[-f] Force shutdown or restart without calling shutdown
[-i] Before shutting down or restarting, turn off all The network interface
[-p] calls poweroff when shutting down. This option is the default option
3. Reboot command
Working process of reboot Similar to halt, its function is to restart, while halt is to shut down. Its parameters are also similar to halt.
4. init command
init is the ancestor of all processes, and its process number is always 1. init is used to switch the running level of the system, and the switching is completed immediately. The init 0 command is used to immediately switch the system running level to 0, that is, shut down; the init 6 command is used to switch the system running level to 6, that is, to restart.
Recommended tutorial: linux tutorial
The above is the detailed content of What are the differences between shutdown commands in linux systems. For more information, please follow other related articles on the PHP Chinese website!