Home  >  Article  >  System Tutorial  >  Understanding the shutdown command in Linux

Understanding the shutdown command in Linux

WBOY
WBOYforward
2023-12-29 20:10:04993browse
Introduction In this article, we will explain to you the shutdown, poweroff, halt and reboot commands. We'll explain what the available options actually do when you execute them. If you want to delve into Linux server management, then these are the important Linux commands you need to fully understand for effective and reliable server management.

理解 Linux 中的 关机命令

Normally, when you want to shut down or restart your machine, you will run one of the following commands:

shutdown command

shutdown will plan a time for the system to shut down. It can be used to stop, shut down, and restart the machine.

You can specify a time string (usually now or hh:mm to specify hours/minutes) as the first parameter. Additionally, you can set up a broadcast message to be sent to all logged in users before the system is shut down.

Important: If the time parameter is used, the /run/nologin file will be created 5 minutes before the system is shut down. to ensure that no one can log in anymore.

shutdown command example:

# shutdown
# shutdown now
# shutdown 13:20  
# shutdown -p now  ### 关闭机器
# shutdown -H now  ### 停止机器      
# shutdown -r09:35 ### 在 09:35am 重启机器

To cancel an upcoming shutdown, just enter the following command:

# shutdown -c
halt command

haltNotify the hardware to stop all CPU functions, but still keep power on. You can use it to keep your system in a low-maintenance state.

Note that in some cases it will shut down the system completely. The following is an example of the halt command:

# halt             ### 停止机器
# halt -p          ### 关闭机器
# halt --reboot    ### 重启机器
poweroff command

poweroff will send an ACPI signal to notify the system to shut down.

The following is an example of the poweroff command:

# poweroff           ### 关闭机器
# poweroff --halt    ### 停止机器
# poweroff --reboot  ### 重启机器
reboot command

reboot Notifies the system to restart.

# reboot           ### 重启机器
# reboot --halt    ### 停止机器
# reboot -p        ### 关闭机器


The above is the detailed content of Understanding the shutdown command in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:linuxprobe.com. If there is any infringement, please contact admin@php.cn delete