Analysis of Linux 5 shutdown commands
㈠shutdown
Www.2cto.com
Shutdown parameter Description:
[Plain]
[-t] before changing to other runlevel, tell Init how long after the shutdown
[-R] Restart the computer
[-K] does not really shut down, just send a warning signal to each login (login)
[-h] power off after shutdown (halt)
[-n] do not use init, but to shut down the machine. The use of this option is discouraged, and the consequences of this option are often not always what you expect to get www.2cto.com
[-c] Cancel current process cancels the shutdown program that is currently executing. So this option certainly does not have a time parameter, but you can enter a message to interpret, and this information will be sent to each user
[-f] Ignore fsck when restarting computer (reboot)
[-f] forcing fsck when restarting computer (reboot)
[-time] Set the time before shutdown (shutdown)
Example:
[Plain]
Shutdown now # shut down immediately
Shutdown +2 # 2 min after shutdown
Shutdown 10:01 # 10:01 shutdown
Shutdown +2 "The machine would shutdown" # 2min after shutting down and notifying the online user
Shutdown-h now shuts down immediately, where it is equivalent to a time of 0,halt,poweroff or can be shut down, or directly init 0
Shutdown-h 20:30 system will be on tonight's 8:30 shutdown
The Shutdown-h +10 system automatically shuts down after 10 minutes.
Shutdown-t3-r now reboots immediately, but in warning and deleting processes this room,
Shutdown-k Now ' hey! Go away! Now ... ' A warning message was issued, but no real shutdown was made.
Using the shutdown command before the system shuts down, the system administrator notifies all logged-on users that the system will be closed
And the login command is frozen, i.e. the new user can no longer log in
It is possible to shut down directly or delay a certain amount of time, and may restart
This is determined by all process (process) receiving the signal (signal) by the system, such as VIM, time to save the document currently being edited
The shutdown execution principle is to send a signal (signal) to the INIT program, requiring it to change runlevel
Run Level 0: shutdown
Run Level 1: Single-user mode, allowing only root users to maintain the system
Run Level 2: Multi-user mode, but cannot use NFS (equivalent to Network Places under Windows)
Run Level 3: Text mode
Run Level 4: undefined
Run Level 5:x window
Run Level 6: Restart
My habit is: SHUTDOWN-FH now
[Plain]
[Email protected] ~]# Who-r
Run-level 5 2013-03-07 15:13 last=s
[Email protected] ~]# RunLevel
N 5
㈡halt
Halt parameter Description:
[Plain]
[-n] prevents the sync system from being called, it is used to patch the root partition with fsck to prevent the kernel from overwriting the patched super block with the old version of the Super Block (superblock)
[-W] is not a real restart or shutdown, just write Wtmp(/var/log/wtmp) records
[-d] do not write wtmp record (included in option [-n])
[-f] forced shutdown or restart without calling shutdown
[-i] turn off all network interfaces before shutting down (or rebooting)
[-p] This option is the default option. Call power off when you shut down the machine
Some versions of halt are power-up after shutdown, such as:
650) this.width=650; "style=" width:630px;height:220.252px; "src=" http://up.2cto.com/2013/0308/20130308111531608. JPG "alt=" 20130308111531608.jpg "/>
In fact, this time has been shut down, but did not turn off the power, need to manually shut down the power
Halt is called Shutdown-h. Halt execution, kill the application process, perform sync, file system write operation will stop the kernel
㈢reboot
Reboot's work process is almost the same as halt, but it's causing the host to restart, and halt is the shutdown
㈣init
Init is the ancestor of all processes, and its process number is always 1, so sending a term signal to init terminates all user processes ﹑ daemons, etc., such as shutdown
The init command uses the above runlevel
㈤poweroff
Soft links pointing to halt