I was trying to shutdown my PC through SSH. I executed

sudo shutdown now

The user was logged-out and Ubuntu starting turning off, but it froze at the last screen with the Ubuntu logo and the loading dots. Any idea where the problem might be?

Also, what's the difference between shutdown and halt? What other similar commands are there?

  • Does it work if you run "sudo shutdown -P now"? Oct 30, 2011 at 2:04
  • or sudo shutdown -h now
    – rigved
    Oct 30, 2011 at 5:36
  • +1 for question. I just had this exact same problem.
    – boehj
    Oct 29, 2012 at 1:24
  • btw: this (also) works from all (other) tty terminals :-) Feb 13, 2013 at 7:54

6 Answers 6


From the MAN PAGES:

Shutdown - "shutdown arranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and, within the last five minutes of TIME, new logins are prevented." Time mentioned here is an amount specify by the user that is shutting down.

Halt - "These programs allow a system administrator to reboot, halt or poweroff the system."

The difference is that Halt can be more "aggressive" when shutting down than Shutdown itself. It has parameters than can literally force the system to shutdown without regarding services or opened programs. If you run halt without any parameters it will simply execute the shutdown command. Something like an alias. If you run it for example with the parameter --force it will "force" the system into a reboot really fast.

In the case of halt or shutdown, they will wait for all processes to finish correctly before turning the PC off or rebooting. If a service or app does not close or does not close properly you will see what you mention there (The ubuntu logo with the dots).

The proper way in the terminal for a single user or multi user is shutdown. But if the shutdown is not working verify what services you have running and which one is causing the slowness or freezing of the shutdown.

With that in mind, there are several ways to reboot or shutdown the system:

Rebooting - shutdown -r, reboot

In this case, reboot is simply calling shutdown -r.

Shutting Down - halt, shutdown, sudo init 0, shutdown -h now, poweroff

In this case, poweroff is the same as calling shutdown -P

As you have noticed, The shutdown command can do a lot of stuff, here is a small list of it:

-r  Requests that the system be rebooted after it has been brought down
-h  Requests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system
-H  Requests that the system be halted after it has been brought down
-P  Requests that the system be powered off after it has been brought down
-c  Cancels a running shutdown. TIME is not specified with this option, the first argument is MESSAGE
-k  Only send out the warning messages and disable logins, do not actually bring the system down

As does the reboot

-f, --force                 force reboot or halt, don't call shutdown(8)
-p, --poweroff              switch off the power when called as halt

There is however a difference between shutdown down through the terminal and clicking on the Shutdown option in Unity. The latter will ask the user for interaction with any unsaved work (like libreoffice, inkscape...). the former will simply send a signal to all processes telling them to close. No user interaction will be needed so any unsaved work will be gone.

  • 2
    So how come Ubuntu shuts down properly when doing it using the shutdown button in the top bar? How is that different from the terminal command? Why does that work and the terminal command doesn't? It's pretty strange ...
    – Frantisek
    Oct 30, 2011 at 2:03
  • 19
    @RiMMER shutdown shuts down the OS, but doesn't actually turn off the computer. You need either an extra argument, like shutdown -P, or to call poweroff instead. (They're the same.) The complete list of similar commands is reboot, halt, poweroff and shutdown. Oct 30, 2011 at 4:56
  • For my case the laptop never powers off with the shutdown button inside unity or the command itself. Oct 30, 2011 at 14:40
  • How do spawn it from XMonad? ("M-S-k", spawn "sudo shutdown now -P") doesn't work. Nov 18, 2011 at 9:36
  • would 'shutdown -P' also work from tty1 (to also shut down tty7 and power-off the machine)? Feb 13, 2013 at 7:35

What you need to do is power off the computer after it shuts down by running the command below:

sudo shutdown -P 20

  • 1
    Why is this better than simply shutdown -P? EDIT: Isn't it able to know when i the good moment to poweroff? May 10, 2018 at 11:55
  • Because if you are "suddenly" not so sure about shutting down anymore, you can cancel the shutdown process. Using no time will do it instantly = no turning back. Also if you are on a server with more people they will get a message that the server will shutdown shortly, leaving them some time to prepare their logoff.
    – s1mmel
    Mar 7, 2019 at 11:12

One another command for shutdown system is

sudo init 0

init 0 calls all of the shutdown scripts and gracefully shuts down your machine.

  • 4
    This needs a bit more explanation I think.
    – don.joey
    May 24, 2013 at 12:06

What is the proper terminal-way to shutdown?

shutdown -h now



Create a script:

shopt -s nocasematch
read -t 30 -N 1 -p 'Shutdown now? (Y/n) '
[[ "$REPLY" =~ n ]] || sudo poweroff

Depending on hw, sw and configuration, the hang on could be do to anything. During shutdown, try to press the DOWN key, so the fancy graphics gives way to the system console and you can see what's going on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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