So how do you shutdown or reboot the Ubuntu Linux server from a terminal or a shell prompt? If GUI is working you can always click on a shutdown button. If GUI is not working or if you are working remotely over ssh type the following commands to shutdown from a terminal:
How do I restart /shutdown from a terminal?
To shutdown / poweroff Ubuntu Linux type any one of the following command:
sudo halt
OR
sudo shutdown -h now
To reboot Ubuntu Linux
Type the command to restart Ubuntu box from the command line:
sudo reboot
More information can be found about these two commands by typing following commands (man page):
man reboot
man shutdown