Linux关机重启命令

Linux有如下的关机和重启命令:shutdown, reboot, halt, poweroff,那么它们有什么区别呢?

shutdown - 建议使用的命令

shutdown是最常用也是最安全的关机和重启命令,它会在关机之前调用fsck检查磁盘,其中-h和-r是最常用的参数:
[plain]  view plain copy
  1. -h:停止系统服务并关机  
  2. -r: 停止系统服务后重启  
[plain]  view plain  copy
  1. -h:停止系统服务并关机  
  2. -r: 停止系统服务后重启  
下面看几个例子:
[plain]  view plain copy
  1. shutdown -h now  --立即关机  
  2. shutdown -h 10:53  --到10:53关机,如果该时间小于当前时间,则到隔天  
  3. shutdown -h +10  --10分钟后自动关机  
  4. shutdown -r now  --立即重启  
  5. shutdown -r +30 'The System Will Reboot in 30 Mins'   --30分钟后重启并并发送通知给其它在线用户  
[plain]  view plain  copy
  1. shutdown -h now  --立即关机  
  2. shutdown -h 10:53  --到10:53关机,如果该时间小于当前时间,则到隔天  
  3. shutdown -h +10  --10分钟后自动关机  
  4. shutdown -r now  --立即重启  
  5. shutdown -r +30 'The System Will Reboot in 30 Mins'   --30分钟后重启并并发送通知给其它在线用户  

reboot 

reboot表示立即重启,效果等同于shutdown -r now

poweroff

poweroff表示立即关机,效果等同于shutdown -h now,在多用户模式下(Run Level 3)不建议使用。

halt

不理会目前系统状况下,进行硬件关机,一般不建议使用

你可能感兴趣的:(Linux关机重启命令)