Linux logo

How to Shutdown Linux by Using Commands

In this tutorial, I am going to show you ways of shutting down the Linux system. First, three ways are given to shutdown using the command line and the last method is for GUI based system.

The commands that can be used to shutdown the system are:

  • shutdown,
  • halt,
  • poweroff
  • reboot

The commands are useful especially once you must reboot a remote Linux server, even in which just shell access can be obtained without a GUI.

First way – Using Shutdown Command

The shutdown command brings down the system in a safe way. Each of the logged-in users is advised that the machine is going down, and login operations are obstructed. It’s possible to close down the system immediately, or after a predetermined delay.

Why utilize shutdown?

The shutdown command stops the machine in a safe way. All particular applications in your machine that’s intended to take steps when shutting down will be informed and given sufficient time.

You also have choices on whether to close the machine immediately or after a time interval which permits you to schedule future events or notify your users about an approaching reboot/shutdown.

On Linux, such as all jobs, both the shutdown and restart operations may also be performed from the command line.

Servers frequently require a restart when updates are installed or you want to shutdown for additional maintenance tasks.

The commands are offered on any Linux system such as CentOS, Ubuntu, Debian, Fedora, or SUSE and don’t need the installation of some additional packages.

Syntax of using the shutdown commands

The general way of using the shutdown command:

$ shutdown [OPTIONS…] [TIME] [WALL…]

An example of simple shutdown command

It is the most basic and simple use. This will shutdown the system.

$ shutdown
How to shutdown and reboot the Linux system

Use the –r option to shutdown and reboot the system:

$ shutdown -r
How to schedule a shutdown

You may also specify the time to shutdown the system. In this way, an advanced notification can be given to the users. An example command is:

$ shutdown 19:00

This will shutdown the system at 7 PM.

Using –h option to halt

To halt system using shutdown commands, you may use the –h option as shown in the command below:

$ shutdown -H
Explicitly shutdown and power off

Though this can be by default, it is still possible to use the -P option to explicitly specify which you need shutdown to power off the system.

$ shutdown -P
The way to cancel a pending shutdown?

As shown in the above section, you may schedule a shutdown by specifying the time. Once you have done that, you may also cancel that by using the –c option:

$ shutdown -c
Example of shutdown with a message

You may also schedule a shutdown with a descriptive message to the users. An example:

$ shutdown +45 "Upgrading hardware "

Bring the system down immediately

$ shutdown now

Bring the system down immediately, and reboot it

$ shutdown -r now
Utilizing reboot command to shutdown

The next command to shutdown/reboot the system is the reboot command.

An example of reboot command:

$ reboot

In order to power off, use the –p option:

$ reboot -p


Forcibly Reboot Linux machine

The next command will reboot the machine forcibly. This is like pressing the power button at the CPU. No shutdown occurs. The machine will reset immediately.

$ reboot -f
Utilize “poweroff” command to shutdown

This command can also be used to shutdown the system.

$ poweroff
How to Close Down Ubuntu

Ubuntu was originally a terminal-based operating platform, but over the years Linux gradually introduced the GUI in its own operating system. These days, GUI methods are the only method to fix many operating system issues.

Ubuntu, the same as the rest of the operating systems, provides a number of methods to close down, and those include such straightforward approaches as clicking a button along with giving instructions to the machine using a terminal.

Shutdown Ubuntu with System menu

If you’re using an Ubuntu Desktop, then it’s easy to shut down or power off the machine. Ubuntu’s system menu provides the choice of a power-off button at a drop-down menu, either in the upper right corner of the background. By clicking on the power button, a dialog box with 3 choices will appear.

  • Cancel
  • Restart
  • Power off

You’ll have the ability to make a decision in 60 seconds. after 60 seconds system will shut down automatically.