Ubuntu: How to Reboot or Shutdown from the Command Line

If you’re using Ubuntu or perhaps another flavour of Linux, there come a time when you need to either reboot (restart) or shutdown a machine via a terminal (command line) or shell command.

Of course, it does come as no surprise that in order to carry out either of these two commands, you will need administrator privileges on the machine that you are currently using, in other words, sudo is once more you best friend.

To shut down / power off your Ubuntu PC, type in the command:

sudo halt


sudo shutdown -h now

Alternatively, to restart / reboot your machine, enter the command:

sudo reboot

As always, more information on both of these commands can be found via the man system:

man reboot

man shutdown

Related Posts:

  • To stop a MySQL server instance on an Ubuntu linux install via the command line is as simple as entering: sudo /etc/init.d/mysql stop Alternatively, to start a MySQL server instance you can simply submit a start command like so: sudo /etc/init.d/mysql start Incidentally, if you want to check on the status of a curr ...

  • SMS Server Tools 3 or SMS3 is a great piece of SMS Gateway open source software that allows you to send and receive short SMS messages through any number of GSM modem types or mobile phones. It installs itself as a service on an Ubuntu Linux machine and after some setup configuration the software is good to go, ve ...

  • Changing the hostname of your Ubuntu server installation is a pretty simple affair. To view the current hostname of your system, simply enter hostname. Now to affect a termporary change of hostname, you could simply use: sudo hostname mynewhostname However, be careful here as this is really just a temporary hostn ...

  • Installing a new software package via a command line terminal in Ubuntu Karmic Koala (and basically all the other versions preceding it) is deceptively easy thanks to the powerful apt-get command that is used as the interface into Ubuntu's Advanced Packaging Tool (APT). It can be used to install new software applic ...

  • To view what version of Ubuntu you currently have installed on your box, the easiest is simply to enter the falling in from the command line: cat /etc/issue or even cat /etc/lsb-release Finally, if you feel like getting your fingers a little deeper in the details surrounding your machine, you can make use of the un ...

About Craig Lotter

Craig Lotter is an established web developer and application programmer, with strong creative urges (which keep bursting out at the most inopportune moments) and a seemingly insatiable need to love all things animated. Living in the beautiful coastal town of Gordon's Bay in South Africa, he games, develops, takes in animated fare, trains under the Funakoshi karate style and for the most part, simply enjoys life with his amazing wife and daughter. Oh, and he draws ever now and then too.