Home  >  Article  >  php教程  >  What are the Linux shutdown commands?

What are the Linux shutdown commands?

高洛峰
高洛峰Original
2016-12-17 17:06:161512browse

 1. Linux system shutdown command-shutdown

 For those who have used XP and win7 systems, they should be familiar with this shutdown command. Of course, if you use the shutdown command to shut down, the system administrator will prompt the user to shut down all the systems you have logged in to. If you force the shutdown command to shut down, it may cause data loss on some processes. In serious cases, it may involve The hardware device has failed.

  When executing the shutdown command, the signal will be passed to the init program, and then the signal will be changed to runlevel, so that runlevel 0 will be used to shut down, and runlevel 6 will be used to activate the reboot system, which is the so-called restarting the computer. . In this way, the command is shutdown plus the parameter command to be executed to shut down the computer. The shutdown command can not only shut down the computer but also perform other functions. For example:

 [-t] Tell init how long to shut down before changing to other runlevels.

 [-r] Restart the calculator.

 [-h] Turn off the power after shutdown [halt]

  [-n] Do not use init, but shut down by yourself. Use of this option is discouraged.

 [-time] Set the time before shutdown [shutdown].

 2. Linux system shutdown command-halt

  As mentioned above, the shutdown -h command refers to the command to turn off the power after shutting down. If we execute halt here, all processes will be shut down and then sync will be executed. System calls. After the operation is completed, you can stop the kernel. Of course, halt also has other function settings. The specific parameters are as follows:

  [-n] Prevent sync system calls. It is used after patching the root partition with fsck to prevent the kernel from overwriting the patched superblock with an older version of the superblock.

 [-w] is not a real reboot or shutdown, it just writes wtmp [/var/log/wtmp] records. [-d] Do not write wtmp records [included in option [-n]].

 [-f] Force shutdown or restart without calling shutdown.

 [-i] Before shutting down (or restarting), turn off all network interfaces.

 [-p] This option is the default option. That is to call powerof

when shutting down. 3. The key command of the Linux system - init

As long as we execute the init 0 command, the computer will be shut down. This is the command to shut down the Linux system. Of course, if you want to use the init command to perform a restart, it is the init 1 command. Executing this command will restart the computer immediately.



For more articles related to Linux shutdown command, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn