「分かりそう」で「分からない」でも「分かった」気になれるLinuxコマンド辞典イメージぴよ画像「分かりそう」で「分からない」でも「分かった」気になれるLinuxコマンド辞典

halt

スポンサーリンク

何するコマンド?

システムを停止してコンピュータの電源を切れる状態にするときに使うコマンド



書き方

halt [オプション]



オプション

オプション説明
--helpヘルプを表示する
Print a short help text and exit.
--haltシステムを停止する。コンピュータの電源を切れる状態にする
Halt the machine, regardless of which one of the three commands is invoked.
-pコンピュータの電源を切る
Power-off the machine, regardless of which one of the three commands is invoked.
--poweroffコンピュータの電源を切る
Power-off the machine, regardless of which one of the three commands is invoked.
--rebootコンピュータを再起動する
Reboot the machine, regardless of which one of the three commands is invoked.
-f強制的に終了する
Force immediate halt, power-off, reboot. Do not contact the init system.
--force強制的に終了する
Force immediate halt, power-off, reboot. Do not contact the init system.
-w/var/log/wtmp」に記録を残すけど、実際の終了処理はやらない
Only write wtmp shutdown entry, do not actually halt, power-off, reboot.
--wtmp-only「/var/log/wtmp」に記録を残すけど、実際の終了処理はやらない
Only write wtmp shutdown entry, do not actually halt, power-off, reboot.
-d「/var/log/wtmp」に記録を残さない
Do not write wtmp shutdown entry.
--no-wtmp「/var/log/wtmp」に記録を残さない
Do not write wtmp shutdown entry.
--no-wall終了前のメッセージを表示しない
Do not send wall message before halt, power-off, reboot.

補足事項

オプションを何も指定しないで

halt

を実行すると、コンピュータの電源が切れる状態になります。

注意点として、電源が「切れる状態になる」です。
システムは停止しますが、電源自体は入ったままの状態です。

私の環境

halt

を実行したところ

System halted

というメッセージが表示されて、うんともすんとも言わなくなりました。
これは

・システムは停止した
・電源は入っている


状態です。
別途、物理的な電源ボタンを押して(あるいは長押しして)電源を切る必要があります。

ちなみに

halt

の実行結果は「shutdown」コマンドを使って

shutdown -H now

を実行するのと同じ結果になります。

スポンサーリンク


書籍画像