This tutorial explains Linux “halt” command, options and its usage with examples.
halt command logs in the file /var/log/wtmp, and then either tells the kernel to halt. If halt is called when the system is not in runlevel 0 , in other words when it’s running normally, shutdown will be invoked instead (with the -h flag), which kills most system processes but does not actually halt the system; it still allows the administrator to remain logged in as root.
Once system processes have been killed and filesystems have been unmounted, the system halts/powers off automatically. This is done using the halt command, which syncs changes to disks and then performs the actual halt/power off.
On Linux, if halt or reboot is run when the system has not already started the shutdown process, it will invoke the shutdown command automatically rather than directly performing its intended action. However, on systems such as FreeBSD, these commands first log the action in wtmp and then will immediately perform the halt/reboot themselves, without first killing processes or unmounting filesystems.
Hence the halt can also be used as
$ shutdown -h now
halt [-n] [-w] [-d] [-f] [-i] [-p] [-h]
halt [-l] [-n] [-q] [-y]
Don’t write the wtmp record. The -n flag implies -d.
Put all harddrives on the system in standby mode just before halt or poweroff.
When halting the system, do a poweroff. This is the default when halt is called as poweroff.
Quick halt. No graceful shutdown is attempted.
Force halt or reboot, don’t call shutdown.
Halt the system, even from a dialup terminal.
Don’t actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).
Shut down all network interfaces just before halt or reboot.
Suppress sending a message to the system log daemon, syslogd, about who executed halt .
Prevent the sync before reboot or halt.
For example :
$ halt -f
This command halts the system immediately without invoking shutdown.
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.