Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What is the difference between the halt and shutdown commands?

share|improve this question

4 Answers 4

up vote 40 down vote accepted

Generally, one uses the shutdown command. It allows a time delay and warning message before shutdown or reboot, which is important for system administration of multiuser shell servers; it can provide the users with advance notice of the downtime.

As such, the shutdown command has to be used like this to halt/switch off the computer immediately (on Linux and FreeBSD at least):

shutdown -h now

Or to reboot it with a custom, 30 minute advance warning:

shutdown -r +30 "Planned software upgrades"

After the delay, shutdown tells init to change to runlevel 0 (halt) or 6 (reboot). (Note that omitting -h or -r will cause the system to go into single-user mode (runlevel 1), 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 or reboots automatically. This is done using the halt or reboot command, which syncs changes to disks and then performs the actual halt/power off or reboot.

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.

share|improve this answer
Good explanation! –  user13742 Jan 27 '13 at 17:31
… but now out of date. On systemd Linux operating systems, these commands exist (in the words of the systemd doco) "for compatibility only". There are not separate halt, reboot, and shutdown programs that invoke one another. There's one single program, with a lot of command-line parsers that funnel into one code path internally. Nor are there run levels. Nor does shutdown go into a single user mode. Indeed, single user mode itself has been renamed. For details, see unix.stackexchange.com/a/196014/5132 . –  JdeBP Apr 14 at 7:18

I suspect this is somewhat dependant on which version of UNIX/Linux you are using. On Centos (and I expec other modern Linux) halt calls shutdown (providing you're not at runlevel 0 or 6) so your system will be shutdown cleanly. On Solaris 10 halt is more brutal, it just flushes the disk caches and powers off the system - no attempt is made to run any scripts or shutdown smf facilities.

share|improve this answer

The past

In the 1980s, the BSDs had halt, reboot, and shutdown. System 5 UNIX had a BSD compatibility toolset. But natively it had its own, different, shutdown command; and didn't have halt or reboot at all. (Some System 5 variants had things like SCO XENIX's haltsys.)

The BSD halt and reboot commands were low-level, drastic, and immediate. The considerate way to shut down a BSD system was the shutdown command, which did all of the things that one expects to happen: wall messages to users, services gracefully killed, log entries written, logins disabled, and so forth.

Whilst the BSDs were largely where the received wisdom originated that "shutdown execs halt/reboot", and that the latter were to be used with care; it was the System 5 world where people learned the contrary habit that halt/reboot were just handy shorthands and nothing more: /usr/ucb/halt, from the "BSD Compatibility Package", was no different in effect to shutdown -h. They both ended up doing init 0.

Further reading


Nowadays, we have a range of possible system management toolsets. The BSDs still have their toolset, albeit purged of any possible AT&Tisms in the 1990s. Miquel van Smoorenburg in 1992 (re-)wrote a Linux init+rc, and their associated tools, which people now refer to as "System 5 init", even though it isn't actually the software from UNIX System 5 (and isn't just init). There are also systemd, upstart, and nosh, each of which have their own implementations of halt, reboot, fasthalt, fastboot, and so forth.

The toolsets have also grown and changed. There's now a poweroff command, not present in 1980s operating systems because the Central Processing Units on most contemporary machines had no way of controlling their power supplies. Linux toolsets in particular have aquired the BSD commands; but like the BSD compatibility tools on UNIX System 5, they aren't exact workalikes and things have been largely flattened.

This flattening has brought us to the point where halt and shutdown are mostly the same. But the exact details vary from toolset to toolset, and the mechanics of each toolset are all slightly different.

It has also brought us to the slightly embarrassing position where this command set has become so festooned with compatibility options that it now allows people to give computers self-contradictory instructions like reboot --halt and poweroff --reboot, as I noted in the manual page for the nosh halt, fasthalt, reboot, fastboot, and poweroff commands. ☺

The systemd toolset

halt, reboot, poweroff, telinit, and shutdown are all one program. It's actually systemd's own systemctl program. It has several command line parsers for the various command line syntaxes of those commands, as well as its own, but after that largely funnels into one code path internally. There's no difference between using halt and its command options to trigger an action and using shutdown and its command options to trigger the same action.

systemd does not consider rescue mode (which is what the systemd people have renamed single user mode) to be a shut down system state, and it is not reachable with any of these commands. Option-less shutdown now is the same as poweroff.

Further reading:

The BSDs

The BSDs largely retain their 1980s semantics. halt and shutdown are thus very much not equivalent in their toolsets. halt and reboot are one single program; and are still low level, immediate, and drastic. Whereas shutdown and poweroff, also one single program, do all of the considerate things like scheduled shutdown, writing wall messages, logging actions, disabling login, and so forth.

In the BSD toolsets, shutdown/poweroff traditionally ended up invoking halt/reboot to enact the final system state change. The (often nowadays incorrect) received wisdom that "shutdown execs halt/reboot" in fact still holds on NetBSD and OpenBSD. But on FreeBSD/PC-BSD/DragonFlyBSD it is only the case if the -o option is used. On these BSDs, both of these programs normally enact the final system state change by sending various signals (INT, USR1, and USR2) to process #1. init does all system state management on on these systems.

On all of them, option-less shutdown now is not equivalent to any of halt, reboot, or poweroff. It transitions to the BSD single user mode, from which one can transition back to multi-user mode.

Further reading:

The nosh toolset

In the nosh system management toolset, halt, fasthalt, poweroff, fastpoweroff, reboot, and fastboot are all one program. It's a backwards compatibility shim that normally simply chains to shutdown, the opposite of received wisdom. The --force option makes it chain to system-control instead.

So there's no difference (absent --force) between the halt command and the shutdown command (with the equivalent option) in this toolset, as this set of "BSD/System 5 compatibility" commands is simply a thin shim layer over the top of shutdown.

The upstart toolset

Like with nosh, in the upstart system management toolset the opposite of received BSD wisdom applies. halt, reboot, and poweroff are all one program, that normally chains to shutdown; unless the --force option is used, which makes it make the reboot() system call itself.

So, again, there's no difference (absent --force) between the halt command and and shutdown command (with the equivalent option) in this toolset. Also again, option-less shutdown now (which none of halt, reboot, or poweroff can end up invoking as they all set options) brings the system into single user mode rather than shutting it down.

Further reading:

The Linux System 5 init+rc toolset

Again, in this toolset the opposite of received BSD wisdom applies and halt and reboot simply chain to shutdown — unless the system is already in the poweroff or halt "run-levels", in which case these commands actually enact the final system state change. shutdown in its turn chains to init.

So, again, there's no difference (unless the system is already largely shut down) between halt and shutdown because the former just invokes the latter. And yes, again, option-less shutdown now (which none of halt, reboot, or poweroff can end up invoking as they all set options) brings the system into single user mode rather than shutting it down.

share|improve this answer

In linux, "halt" and "reboot" are aliases of the shutdown command -- shutdown -h and shutdown -r respectively. Bareword shutdown generally assumes -h.

share|improve this answer
They're not aliases in the sense of shell aliases, but yes, halt basically just calls shutdown -h and reboot runs shutdown -r. Note that if you pass the -f (force) option to halt or reboot, shutdown is not called. –  Mikel Mar 28 '11 at 2:47
Actually, although it is still wrong, on systemd operating systems Shadur's description here is closer to the truth than Mikel's correction is. There's no "A just calls B". They are all alternative ways of invoking one single program, as explained in more detail at unix.stackexchange.com/a/196014/5132 . –  JdeBP Apr 14 at 7:08
@JdeBP Back when I wrote this systemd was out for less than a year and I'd never even heard of it, mind. :) –  Shadur Apr 14 at 9:06
@JdeBP I'd equate them to, say, the sendmail command at this point -- Like with MTAs, it doesn't actually matter what init system you use because all of them will recognize both shutdown and halt as such. –  Shadur Apr 14 at 9:08
Actually, it does matter; because there are subtle, and indeed unsubtle, differences between toolsets. Ironically, that is also the case with the sendmail command. It's like the sendmail command, but not in the way that you think. –  JdeBP Apr 15 at 22:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.