How to use shutdown command under Ubuntu Linux

by on October 9, 2007 · 36 comments· LAST UPDATED October 9, 2007

in , ,

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
OR
$ 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
OR
$ sudo poweroff

How do I reboot computer?

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

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 36 comments… read them below or add one }

1 ashutosh January 30, 2009 at 1:42 pm

Hi, the give commads is working properly.

Reply

2 rajan December 28, 2010 at 1:44 am

my os is ubuntu fdisk -l shut down comand not found please help

Reply

3 amit dulta May 13, 2013 at 5:11 am

following command shut down your system : (sudo shutdown -h 0) try this commsnd…….

Reply

4 andrei March 25, 2009 at 7:29 pm

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

Reply

5 Romain January 17, 2013 at 3:55 pm

That was a BIOS error, the POST process was giving errors, so this has nothing to do with Ubuntu

Reply

6 markus May 6, 2009 at 4:25 pm

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” =)

Reply

7 jadeelite July 15, 2009 at 6:54 pm

sudo init 0 will be working fine thanks

Reply

8 Lucas Renan July 17, 2009 at 10:32 pm

thanx for your help =]

Reply

9 Ruel Manaog July 30, 2009 at 7:52 am

Thanks for this site.

Reply

10 ahmed elmaghrabi August 12, 2009 at 12:36 pm

thx
and to cancel the shutdown use
sudo shutdown -c

Reply

11 Pierre Paquette September 19, 2009 at 12:18 am

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…

Reply

12 mafeth October 22, 2009 at 10:16 am

is there a way to shutdown other computers using my computer in terminal?help!!!!!

Reply

13 andres July 15, 2011 at 6:19 pm

use ssh.

Reply

14 cwdownloder November 11, 2009 at 5:59 am

sombody helpme
how to remotly shutdown ubuntu computer

Reply

15 starver May 26, 2010 at 11:38 pm

yes, by using ssh you can gain full terminal control over a remote computer

Reply

16 mathyie January 15, 2010 at 6:26 pm

how change theubuntu command to simply button in java

Reply

17 xay January 18, 2010 at 4:46 am

i want to sare folder in ubuntu 9.10 server now i can connect to ubuntu but i can not share file and folfer
help me please

Reply

18 Mack June 11, 2010 at 9:48 pm

shutdown -r now gives me:

Broadcast message from adminuser@domain.com
(/dev/pts/2) at 16:55 …

The system is going down for reboot NOW!

But then nothing happens. Might there be a process stopping the shutdown? How do I go about finding out which one so I can kill it – I can’t find anything of relevance in any of the /var/log files

Reply

19 raymon July 31, 2010 at 11:14 am

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)

Reply

20 Irfan Al-Ghozali August 23, 2010 at 5:57 am

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 0×0 SACT 0×0 SERR 0×0 action 0×0
(407.109239) ata 1.00:cmd eo/00:00……./ao tag 0
(407.109241) res s1/04………Emask 0×1 (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.

Reply

21 Irfan Al-Ghozali August 23, 2010 at 6:03 am

And so, I have been use terminal like in here
Help me

Reply

22 Nuc134rB0t November 17, 2010 at 4:41 am

sudo init 6

Reply

23 Barbecue Grill Charcoal February 19, 2011 at 7:33 pm

I am looking for this command.

Reply

24 WarezX February 20, 2011 at 9:37 am

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

Reply

25 Praveen April 4, 2011 at 8:51 am

Ubuntu is cool ;) Very nice collection of Terminal commands :)

Reply

26 Richard "Bloonaholic" April 8, 2011 at 3:05 am

Nice, the terminal commands worked flawlessly!

Reply

27 shuck July 4, 2011 at 7:36 am

how to to reboot to windows 7 while in ubuntu using Teminal?

Reply

28 Romain January 17, 2013 at 3:58 pm

If you installed GRUB boot loader it will ask for an OS at the startup

Reply

29 Pein Nagat0 July 31, 2011 at 2:34 pm

how to link the file of windows 7 to linux ubuntu using clint and server?

Reply

30 Indra Saputra Ahmadi November 11, 2011 at 11:34 pm

how i can shutdown another computer in my networks?

Reply

31 switchoff January 26, 2012 at 6:21 pm

> 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).

Reply

32 vlatko175 March 6, 2012 at 9:57 pm

thank’s work

Reply

33 James April 27, 2012 at 8:01 pm

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

Reply

34 TaGy October 17, 2012 at 9:56 pm

Thanks Broo

Reply

35 leorikz January 9, 2013 at 12:47 pm

thx for help)

Reply

36 ranjith January 14, 2014 at 7:11 am

the cmd shutdown -h doesnot worh in linux mint

Reply

Leave a Comment

Tagged as: , , , , , , , , , , ,

Previous Faq:

Next Faq: