How to use shutdown command under Ubuntu Linux

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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 39 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
39 comments… add one
  • ashutosh Jan 30, 2009 @ 13:42

    Hi, the give commads is working properly.

    • rajan Dec 28, 2010 @ 1:44

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

      • amit dulta May 13, 2013 @ 5:11

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

  • andrei Mar 25, 2009 @ 19:29

    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

    • Romain Jan 17, 2013 @ 15:55

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

  • markus May 6, 2009 @ 16:25

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

  • jadeelite Jul 15, 2009 @ 18:54

    sudo init 0 will be working fine thanks

  • Lucas Renan Jul 17, 2009 @ 22:32

    thanx for your help =]

  • Ruel Manaog Jul 30, 2009 @ 7:52

    Thanks for this site.

  • ahmed elmaghrabi Aug 12, 2009 @ 12:36

    and to cancel the shutdown use
    sudo shutdown -c

  • Pierre Paquette Sep 19, 2009 @ 0:18

    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…

  • mafeth Oct 22, 2009 @ 10:16

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

    • andres Jul 15, 2011 @ 18:19

      use ssh.

  • cwdownloder Nov 11, 2009 @ 5:59

    sombody helpme
    how to remotly shutdown ubuntu computer

    • starver May 26, 2010 @ 23:38

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

  • mathyie Jan 15, 2010 @ 18:26

    how change theubuntu command to simply button in java

  • xay Jan 18, 2010 @ 4:46

    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

  • Mack Jun 11, 2010 @ 21:48

    shutdown -r now gives me:

    Broadcast message from
    (/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

  • raymon Jul 31, 2010 @ 11:14

    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)

  • Irfan Al-Ghozali Aug 23, 2010 @ 5:57

    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.

  • Irfan Al-Ghozali Aug 23, 2010 @ 6:03

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

  • Nuc134rB0t Nov 17, 2010 @ 4:41

    sudo init 6

  • Barbecue Grill Charcoal Feb 19, 2011 @ 19:33

    I am looking for this command.

  • WarezX Feb 20, 2011 @ 9:37

    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

  • Praveen Apr 4, 2011 @ 8:51

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

  • Richard "Bloonaholic" Apr 8, 2011 @ 3:05

    Nice, the terminal commands worked flawlessly!

  • shuck Jul 4, 2011 @ 7:36

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

    • Romain Jan 17, 2013 @ 15:58

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

  • Pein Nagat0 Jul 31, 2011 @ 14:34

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

  • Indra Saputra Ahmadi Nov 11, 2011 @ 23:34

    how i can shutdown another computer in my networks?

  • switchoff Jan 26, 2012 @ 18:21

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

  • vlatko175 Mar 6, 2012 @ 21:57

    thank’s work

  • James Apr 27, 2012 @ 20:01

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

  • TaGy Oct 17, 2012 @ 21:56

    Thanks Broo

  • leorikz Jan 9, 2013 @ 12:47

    thx for help)

  • ranjith Jan 14, 2014 @ 7:11

    the cmd shutdown -h doesnot worh in linux mint

  • Anand Kumar Dec 10, 2014 @ 15:33

    halt is not same as poweroff unless with -p or –poweroff

    so, sudo poweroff is same as sudo halt -p or sudo halt –poweroff

    Please update!

  • the new sysadmin May 6, 2015 @ 14:52

    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.

  • Taylie Cruz Sep 8, 2015 @ 4: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 Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum