Terminal or shell command to shutdown or reboot Ubuntu Linux

So how do you shutdown or reboot Ubuntu Linux from a terminal or a shell prompt? If GUI is working you can always click on a Quit button. If GUI is not working or if you are working remotely over ssh type the following command:

To shutdown / poweroff Ubuntu Linux
Type the command:
sudo halt
OR
sudo shutdown -h now

To reboot Ubuntu Linux
Type the command:
sudo reboot

More information can be found about these two commands by typing following commands (man page):
man reboot
man shutdown

Automated Shutdown via Terminal

Automated shutdown is pretty useful for lots of things. If you’re downloading something and you want the computer to shut down after you’ve finished to save power or if you’re going to sleep and you want to leave the computer on to play some music but really can’t be bothered getting up.

There are program to schedule shutdowns, but here’s a great simple command line prompt alternative:

sudo shutdown -P time

and replace “time” with the number of minutes or time stamp. If you replace it with an integer (e.g. 30) it will count down from that number of minutes then initiate shutdown. e.g. [sudo shutdown -P 30] would shutdown the computer in 30 minutes. If you replace “time” with a time stamp (e.g. 13:30), it would initiate shutdown at that specific time. e.g.[sudo shutdown -P 13:30] would shutdown the computer at 1:30pm. Not that the time is in 24 hour format.

Check out “man shutdown” for more information.

Terminal or shell command to shutdown or reboot Ubuntu Linux

So how do you shutdown or reboot Ubuntu Linux from a terminal or a shell prompt? If GUI is working you can always click on a Quit button. If GUI is not working or if you are working remotely over ssh type the following command:


To shutdown / poweroff Ubuntu Linux

Type the command:

sudo halt

OR

sudo shutdown -h now

OR

sudo shutdown -r now

OR

sudo init 6

To reboot Ubuntu Linux

Type the command:

sudo reboot

More information can be found about these two commands by typing following commands (man page):

man reboot
man shutdown