Analysis of five Linux shutdown commands (I) shutdown www.2cto.com shutdown parameter descriptions: [plain] [-t] before changing to another runlevel, tell init how long it will take to shut down [-r] to restart the computer [-k]. It doesn't actually shut down, but it just sends a warning signal to every executor. [login] [-h] power off after Shutdown [halt] [-n] Don't use init, but shut down it by yourself. You are not encouraged to use this option, and the consequences of this option are often not always the result of your expected www.2cto.com [-c] cancel current process to cancel the Shutdown program currently in progress. Therefore, this option certainly does not have a time parameter, but you can enter a message for explanation, and this information will be sent to each user [-f] to ignore fsck [- f] when restarting the computer [reboot], force fsck [-time] to set the time before shutdown. Example: [plain] shutdown now # shutdown now + 2 # shutdown after 2 minutes shutdown at # shutdown after + 2 "The machine will shutdown" # shutdown after 2 minutes, and notify the online user to shutdown-h now immediately shut down, where now is equivalent to 0, halt, poweroff can also shut down, or the init 0 shutdown-h system will be shut down at tonight. shutdown-h + 10 system will be shut down automatically in 10 minutes. shutdown- T3-r now immediately restarts, but in the case of warning and deletion of processes, shutdown-k now 'Hey! Go away! Now... 'a warning message is sent, but the instance is not shut down. use the shutdown command before shutting down the system. The system administrator will notify all logged-on users that the system is about to shut down and the login Command will be frozen. That is, new users cannot log on and shut down directly or wait for a certain period of time. it is possible to shut down, or restart it. This is determined by the signal [signal] delivered by all processes, such as vim, saving time for the documents being edited. shutdown is executed by sending a signal to the init program, requiring it to change runlevel ● run level 0: shutdown ● run level 1: single-user mode, only root users are allowed to maintain the system ● run level 2: multi-user mode, but NFS is not allowed (equivalent to network neighbors in Windows) ● run level 3: text mode ● run level 4: Undefined ● run level 5: X window ● run level 6: restart my habit: shutdown-Fh now [plain] [root @ Think ~] # Who-r run-level 5 last = S [root @ Think ~] # Runlevel N 5 (ii) halt parameter description: [plain] [-n] prevents sync system calls. It is used after fsck is used to patch the root partition to prevent the kernel from overwriting the patched super block with the old version of superblock [-w] is not a real restart or shutdown, but a wtmp (/var/log/wtmp) record [-d] is not a wtmp record (included in Option [-n ]).] [-f] Before Force shutdown or restart [-I] to shut down [or restart] without calling shutdown, turning off all network interfaces [-p] is the default option. That is, call power off when shutdown. Some versions of halt are continuously powered after shutdown, for example: in fact, it has been shut down at this time, but the power supply has not been turned off, you need to manually turn off the power halt to call shutdown-h. When halt is executed, the application process is killed and sync is executed. After the file system completes the write operation, the kernel (iii) reboot will be stopped. The operation process is similar to that of halt, but it causes host restart. halt is shutdown (iv) init is the ancestor of all processes, and its Process number is always 1. Therefore, sending a TERM signal to init will terminate all user processes, daemon processes, such as shutdown init. command to use the soft link above runlevel (v) poweroff pointing to halt