Stop and restart the operating system. When the system is halted with the halt command, the system is powered off.
Syntax halt [-lnqu] reboot [-lnq] Options -l Do not record the halt or reboot in the system log. This option is intended for applications such as shutdown that call reboot or halt and log this themselves. -n Do not flush the file system cache. This option should probably not be used. -q Halt or restart the system quickly and ungracefully, only the flushing of the file system cache is performed (if the -n option is not specified). This option should probably not be used. -u Halt the system up until the point of removing system power, but wait before removing power for 5 minutes so that an external UPS (uninterruptible power supply) can forcibly remove power. This simulates a dirty shutdown to permit a later automatic power on. macOS uses this mode automatically with supported UPSs in emergency shutdowns.
The halt and reboot utilities flush the file system cache to disk, send all running processes a SIGTERM (and subsequently a SIGKILL) and, respectively, halt or restart the system. The action is logged, including entering a shutdown record into the wtmp(5) file.
Normally, the shutdown utility is used when the system needs to be halted or restarted, giving users advance warning of their impending doom and cleanly terminating specific programs.
SIGTERM TO SIGKILL INTERVAL
The SIGKILL will follow the SIGTERM by an intentionally indeterminate period of time. Programs are expected to take only enough time to flush all dirty data and exit. Developers are encouraged to file a bug with the OS vendor, should they encounter an issue with this functionality.
$ sudo halt
“Soldier: Halt, Who goes there?
King Arthur: It is I, Arthur, Son of Uther Pendragon, from the castle of Camelot. King of the Britons, defeater of the Saxons, sovereign of all England.
Soldier: Pull the other one.” ~ Monty Python and the Holy Grail
Related macOS commands:
shutdown - Shutdown or restart macOS.