You can shutdown or restart your desktop or server with a simple command in bash. It could come in very handy if you ssh into your server or desktop. In this example I a doing it in on Arch Linux with a sudo user. The same commands can be applied in just about any linux distribution such as Ubuntu. You often have to issue the commands as the root user or with sudo in front of the command. (Example: sudo shutdown -r now)
Open up a terminal window
To restart your computer right away type in sudo shutdown -r now


If you want the system to restart in 1 minute type in sudo shutdown -r 1



To just just turn off your computer type shutdown -h now
To shut the computer down in 5 minutes type shutdown -h 5
If you want to cancel a shutdown you can use the command shutdown -c