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

About Craig Lotter

South African software development manager and senior application developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.

Leave a Reply