linux shutdown命令

shutdown [-t 秒] [-arkhncfF] 时间 [警告信息] 
常用选项与参数: 
-t sec : -t 后面加秒数,亦即『过几秒后关机』的意思 
-k : 不要真的关机,只是发送警告信息出去! 
-r : 在将系统的服务停掉之后就重新启动(常用) 
-h : 将系统的服务停掉后,立即关机。 (常用) 
-f : 关机并启动之后,强制略过 fsck 的磁盘检查 
-F : 系统重新启动之后,强制进行 fsck 的磁盘检查 
-c : 取消已经在进行的 shutdown 命令内容。

范例: 

指定5分钟后关机,同时送出警告信息给所有在线用户(也可以无警告信息):
shutdown -h +5 "System will shutdown after 5 minutes"

指定5分钟后关机,用户不会收到提示信息:
shutdown -h +5

指定30秒后关机:
shutdown -t 30

指定现在立即关机:
shutdown -h now

指定14:30分关机:
shutdown -h 14:30

系统立刻重启:
shutdown -r now

仅发送警告信息,不会关闭计算机:
shutdown -k now "System will shutdown after 5 minutes"

取消关闭计算机:
shutdown -c


在关机或重启前,最好使用sync命令来将内存中的数据写入到磁盘,以避免数据丢失。

原文地址:https://www.cnblogs.com/rusking/p/7116529.html