How to use shutdown command under Ubuntu Linux

Posted on in Categories , , , last updated October 9, 2007

Q. I’ve just installed Ubuntu Linux on my computer. I’d like to know – how to shutdown Ubuntu box over ssh session?

A. If you are not using GUI, you can run halt or shutdown command to powerdown box.

shutdown command

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. The shutdown utility provides an automated shutdown procedure for supersers to nicely notify users when the system is shutting down, saving them from system administrators, hackers, and gurus, who would otherwise not bother with such niceties.

How do I use shutdown command?

The shutdown command can be used to turn off or reboot a computer. Type the command as follows to shutdown server / computer immediately:
$ sudo shutdown -h now
$ sudo shutdown -h 0

How do I shutdown compute at specific time?

To shutdown computer at 6:45pm, enter:
$ sudo shutdown -h 18:45 "Server is going down for maintenance"
At 6:30pm message will go out to all user and 6:45 system will shutdown.

Please note that you can also use halt or poweroff or reboot command for stopping and restarting the system:
$ sudo halt
$ sudo poweroff

How do I reboot computer?

Simply use reboot command:
$ sudo reboot
$ sudo shutdown -r 0

39 comment

  1. yes…is working properly, BUT…in my case i saw something weird…i’ve used the command $ sudo shutdown -h XX:YY only for test…the actually countdown time was…1minute…after that the PC has automaticly shutdown… OK…but when i’ve started up the PC…the respons was: “biiiiiiiiiiiiiiiiiiiiiiiiiiiip biiiiip biiiip” and nothing else…it’s a normal reaction? or it’s something wrong with my PC?…eventually i solved the problem…i’ve restarted the power supply and then…voila :D

  2. Hi, I tried after reading this “shutdown” without “sudo”, to check out the command. Then I got the error “-bash: shutdown: command not found”. That confused me, because normaly you can check out the command, but not execute it without “root-authority”
    So don’t forget to add “sudo” =)

  3. Is there any way to make the computer shutdown at a later DATE rather than just a later time? I’m asking because my electricity company says they’ll proceed to work in my area and the “juice” will be cut this coming Monday and this coming Saturday…

  4. The command shutdown -P 0 does not eject my cd-tray with the backtrack4 DVD.Does anybody know of other commands?I have also tried commands as poweroff,eject,logout,exit .
    In Backtrack 3 the dvd gets ejected without problems when logging out,so I don’t think there is anything wrong with my cd-rom station.I have also tried to burn the backtrack4 iso-image to other DVD’s of other brands,but the same problem persists;the cd tray will not eject when logging out.
    (Note that Backtrack 4 is ubuntu-based)

  5. Somebody help me! After my PC have been install Ubuntu 9.10.
    But for shutdown on the Ubuntu. I can’t do it. So My CPU can’t shutdown.
    And then there are like messages or other

    Ubuntu 9.10 irfan-desktop tty1
    irfan-desktop login:(407.109171) ata 1.00:exception Emask 0x0 SACT 0x0 SERR 0x0 action 0x0
    (407.109239) ata 1.00:cmd eo/00:00……./ao tag 0
    (407.109241) res s1/04………Emask 0x1 (device error)
    (407.109340) ata 1.00:status:(DKDY)
    (407.109388) ata 1.00:error:(ABRT)
    (407.931963) System halted

    Help me, please! How to do normal shutdown in ubuntu.
    I hope you can answer my question.

  6. i need help how to sharing network im using win xp dual sun vitualbox backtrack between 3.5G modem HSDPA, could anyone help me how to

  7. > how i can shutdown another computer in my networks

    linux (I suggest, there is a windows-cli-command called “shutdown”, which works for remote windows systems to shut them down or reboot them too, but I don’t know any details):

    1.) a) install an ssh-server (and client) on your remote linux computer
    1.) b) install an ssh-client (windows: f.i. PuTTY)
    2.) connect to remote linux system (linux: > ssh @
    3.) use ‘sudo reboot’ for reboot or ‘sudo poweroff’ to power off the remote linux system

    another hint:

    ‘halt’ is NOT equal to ‘poweroff’ (tested on ubuntu 11.10)

    If you use ‘sudo halt’ on linux cli, the system will shut down, but not power off, so you have to push to power off button (or power off the virtual machine) manually.
    ‘sudo poweroff’ will additionally power off the computer (or the VM).

  8. How would I issue a reboot command and include a message that to all users that the system will be rebooting in an hour?

  9. Good question. I haven’t seen my solution here so here are my 2 cents. *Disclaimer, the following is an unorthodox method, but if your main goal is to shut down a box to for instance save energy do the following. Take a sledgehammer and beat the server up. This process depends on physical strength, but on average should not take longer than 1 minute. This would however require you to have physical access to the server. Fortunately the sledgehammer can also come in handy here for bypassing or trespassing server storage facilities. As with anything use the right tool for the right situation. But never forget to think out of the box.

  10. The IP address of the computer you are using is and currently logged in using SSH. You can also access a shutdown command. Question: If you execute the shutdown command in your computer, which computer unit will turned off (your own computer, the computer that has an IP of, both computers)? And why?

Leave a Comment