それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

shutdown コマンドについて調べました。

なんとなく使っているshutdown

Ubuntu デスクトップを使っていと、なんとなく、reboot だとか shutdown コマンドを打ち込んでるんですよね。

今すぐシャットダウン

shutdown -h now 

強制シャットダウンをわりと気軽に打ち込んでるんだけど、shutdown コマンドってたしかスケジュールできたよな。と思って調べました

今すぐシャットダウン

shutdown now

今すぐ、再起動

shutdown -r now

15分後にシャットダウン

showdown +15

60 分後に再起動

shutdown -r +60

13:33に再起動

shutdown -r 13:33

キャンセル

さっき再起動って言ったな、やっぱりなし

shutdown -c 

シャットダウンコマンドの他

シャットダウンのコマンドの他に似たような物がある。

halt
reboot 

などコマンドは多数あります。好きなのを使えばいいんだけど、じつは微妙に違うんだけど再起動・シャットダウンする目的であれば、あまり気にせず使える。

最後に起動したのって何時だっけ

uptime を見ればわかるのですが、uptimeの基準になる起動時間最後のshutdown -r を見ることが出来る。

takuya@~$ who -b
         system boot  2020-04-28 18:30

最近どれくらい reboot してるんだ

最近の再起動の履歴を見ることが出来ます。

takuya@:~$ last -x reboot
reboot   system boot  4.19.0-8-amd64   Fri Apr 24 05:13   still running
reboot   system boot  4.19.0-8-amd64   Wed Apr  8 03:15 - 05:12 (16+01:57)
reboot   system boot  4.19.0-8-amd64   Sat Apr  4 18:20 - 03:14 (3+08:54)
reboot   system boot  4.19.0-8-amd64   Thu Mar 26 16:22 - 18:20 (9+01:57)
reboot   system boot  4.19.0-8-amd64   Fri Feb 28 17:38 - 16:22 (26+22:43)
reboot   system boot  4.19.0-8-amd64   Fri Feb 28 17:30 - 17:37  (00:07)
reboot   system boot  4.9.0-11-amd64   Sun Feb  9 06:50 - 17:37 (19+10:46)
reboot   system boot  4.9.0-11-amd64   Sat Feb  8 23:22 - 17:37 (19+18:15)
reboot   system boot  4.9.0-11-amd64   Sat Feb  8 20:33 - 17:37 (19+21:04)
reboot   system boot  4.9.0-11-amd64   Sat Feb  8 18:35 - 17:37 (19+23:02)
reboot   system boot  4.9.0-11-amd64   Sat Feb  8 12:00 - 17:37 (20+05:37)
reboot   system boot  4.9.0-11-amd64   Sat Feb  8 07:22 - 17:37 (20+10:15)
reboot   system boot  4.9.0-11-amd64   Fri Feb  7 21:18 - 17:37 (20+20:19)
reboot   system boot  4.9.0-11-amd64   Fri Feb  7 18:55 - 17:37 (20+22:41)
reboot   system boot  4.9.0-11-amd64   Fri Feb  7 11:41 - 17:37 (21+05:56)

参考資料