|

Shutdown or Restart Ubuntu Using Linux Command Line [Beginner’s Tip]

This quick tutorial teaches you how to shutdown Ubuntu or any other distributions from the Linux command line.

How to shutdown Ubuntu?

There are two ways to shutdown Ubuntu Linux. Go to the upper right corner and click the drop down menu. You’ll see the shutdown button here. You can also use the command ‘shutdown now’.

In this article, I’ll discuss both GUI and terminal way of shutting down an Ubuntu system.

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:

Restart or shutdown Ubuntu Linux
Click on the top right panel to bring the settings menu

If you click on the power-off button, it will give you three options: Cancel, Restart and Power Off. You can choose the one you want.

Restart or shutdown Ubuntu Linux
Choose if you want to shutdown or restart

This article is specifically focused on Ubuntu server editions. You are probably stuck in a terminal and wonder how to shutdown 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 shutdown command without any arguments, it will shutdown 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 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 schedule 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

I hope these quick tips helps you to shutdown and restart Ubuntu and other Linux distributions from the command line. Any questions or suggestions are always welcomed.

Similar Posts

  • have updated to 21.10 but computer does not power off after clicking shutdown. have to long press the power button and then re-press to start