the difference between shutdown, poweroff, halt and reboot

In this article, we will explain to you the difference between shutdown, poweroff, halt and reboot Linux commands. We will make clear what they actually do when you execute them with available options.

If you are hoping to dive into Linux server administration, then these are some of the important Linux commands you need to fully understand for effective and reliable server administration.

Normally, when you want to turn off or reboot your machine, you’ll run one of the commands below:

Shutdown Command
shutdown schedules a time for the system to be powered down. It may be used to halt, power-off or reboot the machine.

You may specify a time string (which is usually “now” or “hh:mm” for hour/minutes) as the first argument. Additionally, you may set a wall message to be sent to all logged-in users before the system goes down.

Important: If the time argument is used, 5 minutes before the system goes down the /run/nologin file is created to ensure that further logins will not be allowed.

Examples of shutdown commands:

# shutdown
# shutdown now
# shutdown 13:20  
# shutdown -p now   #poweroff the machine
# shutdown -H now   #halt the machine       
# shutdown -r09:35  #reboot the machine at 09:35am

To cancel a pending shutdown, simply type the command below:

# shutdown -c

Halt Command
halt instructs the hardware to stop all CPU functions, but leaves it powered on. You can use it to get the system to a state where you can perform low level maintenance.

Note that in some cases it completely shuts down the system. Below are examples of halt commands:

# halt         #halt the machine
# halt -p      #poweroff the machine
# halt --reboot    #reboot the machine

Power off Command
poweroff sends an ACPI signal which instructs the system to power down.

The following are examples of poweroff commands:

# poweroff             #poweroff the machine
# poweroff --halt      #halt the machine
# poweroff --reboot    #reboot the machine

Reboot Command
reboot instructs the system to restart.

# reboot            #reboot the machine
# reboot --halt     #halt the machine
# reboot -p         #poweroff the machine

That’s all! As mentioned earlier on, understanding these commands will enable to effectively and reliably manage Linux server in a multi-user environment. Do you have any additional ideas? Share them with us via the comments section below.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Linux 系统的关机命令是 "shutdown"。 使用方法: ``` shutdown [选项] 时间 ``` 时间可以是 "now" 表示立即关机,也可以是一个具体的时间,格式为 "HH:MM",表示在指定的时间关机。 例如,要立即关机,可以使用命令: ``` shutdown now ``` 要在当前时间的一小时后关机,可以使用命令: ``` shutdown +1 ``` 要在指定的时间关机,可以使用命令: ``` shutdown 18:00 ``` 注意:使用关机命令时,需要 root 权限。 常用选项: - -h:关机后关闭电源。 - -r:关机后重启。 - -c:取消先前的关机命令。 - -k:不执行关机操作,只发送警告信息。 关于 shutdown 命令的详细用法,可以使用命令 "man shutdown" 查看。 ### 回答2: Linux 关机命令有很多种方式,常用的有以下几种: 1. shutdown 命令:shutdown 命令用于安全地关闭系统,可以通过在终端输入 "shutdown" 命令来使用。例如,在终端输入 "shutdown now",系统会立即关机。 2. poweroff 命令:poweroff 命令用于立即关机系统,可以通过在终端输入 "poweroff" 命令来使用。例如,在终端输入 "poweroff" 命令,系统会立即关机。 3. halt 命令:halt 命令也可以用于立即关机系统,可以通过在终端输入 "halt" 命令来使用。例如,在终端输入 "halt" 命令,系统会立即关机。 4. init 命令:init 命令用于改变系统的运行级别,从而实现关机的目的。可以通过在终端输入 "init 0" 命令来关机。例如,在终端输入 "init 0" 命令,系统会进入到运行级别 0,并最终关机。 总结起来,Linux 关机命令可以使用 "shutdown"、"poweroff"、"halt" 或 "init" 命令来实现。具体选择哪种方式取决于个人需求和使用场景。 ### 回答3: Linux的关机命令是shutdownshutdown命令用于安全地关闭系统。可以使用不同的参数来指定关机的方式和时间。 常用的参数有: 1. -h:关机后立即关闭电源。 2. -r:关机后重新启动系统。 3. -H:关机后不关闭电源,仅停止系统运行。 4. -P:关机后关闭电源。 5. -t:指定延迟关机的时间,后面接分钟数。 例如,要立即关机并关闭电源,可以使用以下命令: shutdown -h now 要安排延迟关机10分钟,可以使用以下命令: shutdown -h +10 还可以通过-c选项取消之前安排的关机命令。 另外,还可以使用haltpoweroff和reboot命令来实现关机和重启操作。haltpoweroff命令都可以用于系统的正常关机,reboot命令用于系统的重启。 总结起来,Linux的关机命令有shutdownhaltpoweroff和reboot,具体使用取决于需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值