linux关机重启命令

一、shutdown命令:

格式:shutdown [OPTIONS...] [TIME] [WALL...]:

         shutdown [选项] [时间] [提示信息]

选项:

       --halt   停止计算器,没有切断电源

       -P    关机,切断电源

       -r     重启

       -c                取消关机

时间:

       +10   表示10分钟以后

       22:10   表示当天22:10

       now     此时

举例:今天19:00关闭计算机,并进行提示

# shutdown 19:00 "shutdown the server at 19:00"

Broadcast message from root@212
        (/dev/pts/0) at 19:35 ...

The system is going down for maintenance in 1405 minutes!
shutdown the server at 19:00 

注意:

CentOS6:shutdown命令必须要跟时间;CentOS7:shutdown默认一分钟后关机

有的时候shutdown命令无法关机,需要加-P强制关机

 

二、halt命令:

# halt      CentOS6关机,CentOS7停止计算机

# halt -p      关机,切断电源

# halt --reboot   重启(CentOS7支持)

 

三、poweroff命令:

# poweroff --halt        停止计算器,没有切断电源(CentOS7支持)

# poweroff                  关机,切断电源

# poweroff --reboot   重启(CentOS7支持)

 

四、reboot命令:

# reboot --halt     停止计算机,不切断电源(CentOS7支持)

# reboot -p      关机,切断电源

# reboot        重启

注意:halt、poweroff、reboot3个命令功能相似。都可以实现停止计算机,关闭电源,重启三种功能

 

 五、init命令

# init 0    关机

# init 6    重启

原文地址:https://www.cnblogs.com/ysuwangqiang/p/11336038.html