halt【コマンド】
コマンドだよ
UNIX系で使えるよ
コンピュータの電源を切れる状態にするよ
スポンサーリンク
簡単に書くよ
halt【コマンド】とは
コンピュータさんに対する命令文(コマンド)のひとつ
であり
システムを停止してコンピュータの電源を切れる状態にするときに使うコマンド
です。
詳しく書くよ
「halt」コマンドは
システムを停止してコンピュータの電源を切れる状態にするときに使うコマンド
です。
UNIX系(LinuxとかMacとか)で使えます。
書き方は
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. |
| --halt | コンピュータの電源を切る Power-off the machine, regardless of which one of the three commands is invoked. |
| --halt | コンピュータを再起動する Reboot the machine, regardless of which one of the three commands is invoked. |
| -f | 強制的に終了する Force immediate halt, power-off, halt. Do not contact the init system. |
| --force | 強制的に終了する Force immediate halt, power-off, halt. Do not contact the init system. |
| -w | 「/var/log/wtmp」に記録を残すけど、実際の終了処理はやらない Only write wtmp shutdown entry, do not actually halt, power-off, halt. |
| --wtmp-only | 「/var/log/wtmp」に記録を残すけど、実際の終了処理はやらない Only write wtmp shutdown entry, do not actually halt, power-off, halt. |
| -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, halt. |
などです。
使い方は簡単です。
オプションを何も指定しないで
halt
を実行すると、コンピュータの電源が切れる状態になります。
注意点として、電源が「切れる状態になる」です。
システムは停止しますが、電源自体は入ったままの状態です。
私の環境で
halt
を実行したところ
System halted
というメッセージが表示されて、うんともすんとも言わなくなりました。
これは
・システムは停止した
・電源は入っている
状態です。
別途、物理的な電源ボタンを押して(あるいは長押しして)電源を切る必要があります。
ちなみに
halt
の実行結果は「shutdown」コマンドを使って
shutdown -H now
を実行するのと同じ結果になります。
基本的な使い方は、それだけです。
オプションは必要に応じて勉強してください。
一言でまとめるよ
まぁ「halt」ってコマンドが出てきたら「コンピュータの電源を切れる状態にするときに使うんだな~」と お考えください。






