Linux shutdown: commands for shutting down and restarting Linux

“Shutdown” refers to the process of stopping and shutting down a computer or server. This involves cutting the power to the main components of the system using a controlled process. Applications are closed, active processes and protocols are saved to the hard drive, device drivers are removed, and user settings are saved in the process. Linux operating systems can easily be stopped, shut down, and restarted using the shutdown command and its various options. Linux shutdown commands are entered in the Linux terminal that is launched by using the keyboard shortcut [Ctrl] + [Alt] + [T]. You can then close the terminal window with the shortcut [Ctrl] + [D].

$1 Domain Names – Grab your favorite one
  • Simple registration
  • Premium TLDs at great prices
  • 24/7 personal consultant included
  • Free privacy protection for eligible domains

The essential Linux shutdown commands

When shutting down or restarting Linux via the terminal, the “shutdown” command is essential. You can add an option to it followed by a time specification and a message. The syntax of the Linux shutdown command is as follows:

shutdown [OPTION] [TIME] [MESSAGE]

There is at least one alternative for each command listed here that produces the same result.

Standard command for shutting down Linux

shutdown -h

Linux will shut down in under a minute. The “-h” option explicitly stands for the shutting down or powering off of a system. You can usually produce the same results by just entering the shutdown command on its own.

shutdown

Standard command for restarting Linux

shutdown -r

Linux will be restarted in under a minute. The “-r” option stands for reboot or restart.

Command for shutting down Linux immediately

shutdown -h 0

Linux will immediately be shut down. In this case, the shutdown command is followed by the “-h” option and the time specification “0” which means immediately. The following is another far more common command for shutting down Linux immediately:

shutdown now

Command for restarting Linux immediately

shutdown -r 0

Linux will immediately be restarted. In this case, the shutdown command is followed by the “-r” option and the time specification “0” which means immediately. The following is a frequently used command for restarting Linux immediately:

shutdown -r now

The standard Linux shutdown command with the one-minute time delay is especially useful for multi-user solutions (i.e. when multiple users are accessing a Linux computer or server). In this situation, the network administrator is able to set up a warning message as a wall message to inform users that the system will be shut down or restarted shortly. If Linux is only being used on a single computer, the commands for immediately shutting down or immediately restarting Linux are usually just as simple.

Tip

You can only use shutdown commands on Linux if you have the necessary administrator rights. You can get around this on some Linux systems by simply adding the “sudo” command before the Linux shutdown command in question (e.g. “sudo shutdown now” or “sudo shutdown -r 0”).

Scheduling Linux shutdowns or restarts

You can also easily schedule Linux shutdowns or restarts to occur after a certain period of time or at a certain time. To do this, you have to add the number of minutes or the time after the corresponding Linux shutdown command, as shown in the examples below:

Command for shutting down Linux after 20 minutes

shutdown -h 20

Linux will shut down 20 minutes after the command is entered. The following command is sometimes more commonly used and produces the same result:

shutdown +20

Command for restarting Linux after 20 minutes

shutdown -r 20

Linux will restart 20 minutes after the command is entered. You can also use the plus sign with this command.

shutdown -r +20

Command for shutting down Linux at 5:30 p.m.

shutdown -h 17:30

Time specification is based on the 24-hour format in Linux in accordance with the syntax (hh:mm). In this example, Linux is shut down at 5:30 p.m. (i.e. 17:30). Once again, you can omit the “-h” option which stands for the shutting down or powering off of a system:

shutdown 17:30

Command for restarting Linux at 5:30 p.m.

shutdown -r 17:30

Linux will restart at 5:30 p.m. (i.e. 17:30). In this case, the “-r” option, which stands for “reboot”, obviously cannot be omitted – otherwise, Linux would shut down without rebooting.

Linux shutdown – additional commands

In addition to the previously mentioned Linux shutdown commands, there are a number of other commands and options for stopping, shutting down, and restarting Linux operating systems. These can generally also be combined with commands for scheduled Linux shutdowns.

Note

There is a difference between “stopping a system” and “turning off a system”. When you stop it, all the processors (CPUs) are stopped, but when you turn it off, it is also cut off from the main power supply. Generally, the term “shutdown” is understood to be the stopping and powering off of a system.

Command for powering off Linux

shutdown -P

This command explicitly indicates that the system will be shut down and the main power supply will be cut off.

Command for setting up a wall message

shutdown 'WRITE YOUR WALL MESSAGE HERE'

A wall message is information that is displayed on the screen of the operating system users. For example, an administrator can use a wall message to inform users that the system is being shut down.

Command for canceling scheduled shutdowns or restarts

shutdown -c

Using this command, you can cancel a scheduled shutdown or restart. This requires that the process has not yet started.

Using simple commands in the Linux terminal, you can stop, shut down, and restart your operating system. As an alternative to entering Linux shutdown commands directly, you can install a graphical user interface using software, such as the program shutdown which is especially suited to the Linux distribution Ubuntu.

Note

You can find all the essential commands you need to control a Linux operating system via a terminal in our article “An overview of the most important Linux commands”.

Was this article helpful?
We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.
Page top