Shutdown or Restart Ubuntu Using Linux Command Line

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

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.

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 by clicking on the poweroff button on top right button
Click on the top right panel to bring the settings menu

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.

Choose if you want to shutdown or cancel
Shutdown Ubuntu Linux

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.

Linux Shutdown Command: 5 Practical Examples
The shutdown command in Linux allows you to shut down, reboot or schedule a shutdown of your system. This article explains the most common and useful examples of the Linux shutdown command.

If you think that shutdown is taking longer than expected, here are some troubleshooting advice.

Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux
Your Linux system is taking too long to shut down? Here are the steps you can take to find out what is causing the delayed shutdown and fix the issue. I hope you are a tad bit familiar with the sigterm and sigkill concept. When you shut down your Linux

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.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.