Shutdown or Restart Ubuntu Using Linux Command Line … – It’s FOSS

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

How to shut down Ubuntu?

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

In this article, I will discuss both the GUI and the terminal way to shut down an Ubuntu system.

Shut down Ubuntu graphically (for desktop users)

  • Shut down
  • Ubuntu

  • using the command line (for both desktop and Ubuntu server users)

1. Shut down Ubuntu graphically

If you use the Ubuntu desktop, you will have no trouble finding the shutdown and 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 the power off button, it will give you three options: Cancel, Restart, and Shut Down. You can choose the one you want.

This article focuses specifically on Ubuntu server editions. You’re probably stuck in a terminal and wondering how to shut down or restart the system from the command line.

2. Restart or shut down Ubuntu Linux in

the terminal

There are several commands you can use to shut down Linux from the terminal. I would recommend the shutdown command. It is easy to remember and easy to use.

Let’s see how you can use this shutdown command to shut down or restart your system.

Shut down Ubuntu Linux immediately

If you use the shutdown command without any argument, it will shut down your system within a minute. You can change the behavior and shut down Ubuntu immediately using: shut down

now Schedule a shutdown

in Ubuntu Linux

You can schedule a shutdown in several ways.

For example, to schedule a shutdown at 03:30 PM, you can use the command as follows

: sudo off 15:30 You don’t

always have to specify the absolute time. It can also provide relative time.

For example, to schedule a shutdown within 20 minutes, you can use

the shutdown command like this: sudo off +20 Restart Ubuntu Linux

immediately Restarting Ubuntu

can also be done with the wonderful shutdown command in Linux. Simply use the -r option to specify that this is a restart request.

By default, if you only use shutdown -r, it will restart your system after a minute.

You can immediately restart Ubuntu

from the terminal using the now option like this

: sudo shutdown -r now Schedule a restart

in Ubuntu Linux

You can also schedule a restart the

same way you scheduled

a shutdown. To schedule a restart at 3:30 PM, you can use: sudo off -r 15:

30 To schedule

a restart

within 20 minutes, You can use:

sudo shutdown -r +20 Cancel a scheduled shutdown or restart If you have scheduled a

shutdown or restart

and then realized that you don’t need it, you can easily cancel it. Just use the -c option with the shutdown command: sudo shutdown -c

I hope these quick tips help you shut down and restart Ubuntu and other Linux distributions from the command line. Any questions or suggestions are always welcome.