What is the correct way to turn off a Unix/Linux server?

From my googling, I have learned (hopefully) the following:

shutdown: I should use this, with the parameter -h to halt, or the parameter -r to reboot

halt: halts the computer (stops the processor? does this physically turn the power of the computer off?). I think this will call shutdown if not at init0, otherwise just halts.

reboot: if not at init6, calls shutdown, otherwise just reboots the computer.

if all that is correct, then the only thing I can't figure out is what exactly 'halt' does. Does it just stop the processor but not turn the computer physically off? How do I "poweroff" the computer?



shutdown -h now will shut off the computer with most systems, but it is left up to the implementation. Use -P to poweroff for sure and -H to halt for sure. This is the method I would recommend to shut the system down. It will run all the proper scripts.

halt without -f will just call the above shutdown and so will reboot, they are basically just aliases.

  • I am a big fan of /sbin/shutdown -h(-r) now. using "halt" always scared me. – RateControl Aug 3 '09 at 16:07
  • 1
    Thoreau makes another good point: you should try to make a habit of calling important system commands with an explicit path, ( e.g. /sbin/shutdown ). This might save you if your system is ever compromised and you are not aware of it. – Ryan Fisher Aug 3 '09 at 17:40
  • 1
    mystikphish: Agreed, going to adopt that habit. Although he has a good point, I don't know if I would trust his advice on IT in general if he spends all his time in a one room cabin with no electricity. – Kyle Brandt Aug 3 '09 at 18:37
  • It would be a poor compromise if it didn't change the executable in the path that is engrained in your fingers though... – asjo Aug 3 '09 at 20:48
  • @Kyle Brandt, nice. – Joseph Kern Aug 4 '09 at 11:23

On Linux, I have always used reboot and halt, though I also know people who find halt scary. halt(8) sort of tells why:

Under older sysvinit releases, reboot and halt should never be called directly. From release 2.74 on halt and reboot invoke shutdown(8) if the system is not in runlevel 0 or 6. This means that if halt or reboot cannot find out the current runlevel (for example, when /var/run/utmp hasn't been initialized correctly) shutdown will be called, which might not be what you want. Use the -f flag if you want to do a hard halt or reboot.

sysvinit 2.74 is dated 17-Mar-1998 21:53. :)

Regarding your question how to power off, you could use poweroff or halt -p. Most recent Linux systems seem to power down on just halt or shutdown -h also.

  • Solaris is still in the crowd where 'halt' does scary things. – Karl Katzke Aug 4 '09 at 19:43

I use halt - less parameters to remember.

Someone have developed a virtual Molly Guard to ensure one does not stop the wrong server by accident. It has saved me on a few occasions. It's packagned in molly-guard on Ubuntu.


I generally use (as the root user of course):

 init 0

to bring the system to a power off state. This performs rundown scripting.

 init 6

to bring down the system and to have it automagically reboot. This also performs rundown scripting.

  • 1
    halt would also run all initscripts with "stop" parameter. – hayalci Aug 3 '09 at 20:32
  • 1
    On what system does halt not shut down nicely? – asjo Aug 3 '09 at 20:48
  • 2
    Based on the above two comments I edited my note to remove my halt comment. However, I verified on FreeBSD 7.2, and Solaris 10 5/2009 x86 executing the simple halt command on these two systems will NOT engage standard rundown sequence. However, on Centos 5.3, OpenSUSe 11.1, and Fedora 11 the halt command DOES engage the standard rundown sequence and acts basically like init 0. FYI.... – mdpc Aug 4 '09 at 5:42

Worth noting here:

Solaris needs either "shutdown -y -i5 -g0" to shut down, or "shutdown -y -i6 -g0" to reboot. Halt or Reboot on Solaris should only be used when it's acceptable to not give a warning or grace period before you start shutting things down... this can kind of play havoc with disk systems if you don't unmount them before shutting off, y'know?

It's best to adopt procedures that are best for the operating systems you touch daily, so that you don't accidentally screw something badly at 2am with your fingers on autopilot.

For instance, never type 'killall' in solaris, whereas that's a fairly common command in linux. 'pkill' works the same on both, though.


To shut it down immediately ,type:

shutdown -h now 

and to shut it down immediately and restart type:

shutdown -r now
  • 1
    I find this the best answer, not sure why downvoted. – Basil A Mar 5 '19 at 12:11

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