There are two ways to shutdown Ubuntu Linux. Go to the upper right corner and click the dropdown menu. You’ll see the shutdown button here.
You can also use the command for an immediate shutdown:
shutdown now
In this article, I’ll discuss both GUI and terminal way of shutting down an Ubuntu system.
- Shutdown Ubuntu graphically (for desktop users)
- Shutdown Ubuntu using command line (for both Ubuntu desktop and server users)
1. Shutdown Ubuntu graphically
If you use Ubuntu desktop, you would have no problems in finding the shutdown and the restart option located in the top right corner. If you do, you can extend the next section to see what it looks like.
It may depend on the desktop environment but usually, you’ll see the option in the top right corner:
If you click on the Power Off button, it will give you the options: Cancel and Power Off. You can choose the one you want.
This article is specifically focused on Ubuntu server editions. You are probably stuck in a terminal and wonder how to shut down or restart the system from the command line.
2. Restart or Shutdown Ubuntu Linux in Terminal
There are multiple commands you can use to shutdown Linux from the terminal. I would recommend the shutdown
command. It’s easy to remember and easy to use.
Let’s see how can you use this shutdown command for shutting down or restarting your system.
Shutdown Ubuntu Linux immediately
If you use the shutdown
command without any arguments, it will shut down your system in one minute. You can change the behavior and shutdown Ubuntu immediately using:
shutdown now
Schedule a shutdown in Ubuntu Linux
You can schedule a shutdown in various ways.
For example, to schedule a shutdown at 03:30 PM, you can use the command in the following fashion:
sudo shutdown 15:30
You don’t always have to specify the absolute time. You can provide a relative time as well.
For example, to schedule a shutdown 20 minutes from now, you can use shutdown command like this:
sudo shutdown +20
Restart Ubuntu Linux immediately
Restarting Ubuntu can also be done with the wonderful shutdown command in Linux. You just have to use the -r
option to specify that it’s a reboot request.
By default, if you just use shutdown -r
, it will reboot your system after one minute.
You can immediately restart Ubuntu from terminal using the now
option like this:
sudo shutdown -r now
Schedule a restart in Ubuntu Linux
You can also schedule a restart in the same way you scheduled a shutdown.
To schedule a restart at 3:30 PM, you can use:
sudo shutdown -r 15:30
To schedule a restart 20 minutes from now, you can use:
sudo shutdown -r +20
Cancel a scheduled shutdown or reboot
If you have scheduled a shutdown or a restart, and later you realized that you don’t need it, you can cancel it easily. You just have to use the -c
option with shutdown command:
sudo shutdown -c
More on shutdown and reboot
If you are interested, you can refer to some more example of the shutdown command.
If you think that shutdown is taking longer than expected, here are some troubleshooting advice.
I hope these quick tips help you to shut down and restart Ubuntu and other Linux distributions from the command line. Any questions or suggestions are always welcome.