5、关机命令:shutdown
–help 后发现选项参数还真的不少,现在逐个简述下吧:
-r 关闭系统后自动重启 【重启常用】
-h 关闭系统后关闭电源或挂起 【关机常用】
-H 关闭系统后挂起
-P 关闭系统后关闭电源
-c 取消正在执行的shutdown命令 【也挺常用。。】
-k 仅仅发送一下警告消息,不关系统。【吓唬人用的?】
-q 静默方式
shutdown命令的使用格式是:
shutdown 【选项】时间 【发送的消息】
时间的使用是这样的:
TIME may have different formats, the most common is simply the word ‘now’ which will bring the
system down immediately. Other valid formats are +m, where m is the number of minutes to wait
until shutting down and hh:mm which specifies the time on the 24hr clock.
时间可以是 now ,就是立即的意思。
也可以用 +m的格式,就是再过m分钟的意思。
当然也可以用 hh:mm 格式(24小时的时分格式)
#################################################################
例子如下:
立即关机: shutdown -h now
再过3分钟重启系统,并发送警示信息“下雨了收衣服了。。。。”
shutdown -r +3 “下雨了收衣服了。。。。”
今天下班早走一下,机器定在17:15自动关机:
shutdown -h 17:15
#################################################################
6、重启命令:reboot
reboot使用比较简单,常用参数有
-n 不同步
-f 强制重启
-p 关机
当然了使用 sync;sync;sync;reboot 是一个很好的习惯,要习惯使用!
另外还有类似的命令 halt, poweroff等等。这些东东需要在使用中逐个体会小区别。