Read in 3 minutes
Linux Shutdown Command
In this tutorial, we will show you how to use the shutdown command through practical examples and detailed explanations of the most common shutdown options.
The shutdown command brings the system down in a secure way. When the shutdown is initiated, all logged-in users and processes are notified that the system is going down, and no further logins are allowed. You can shut down your system immediately or at the specified time.
Shutdown Command Syntax
Before going into how to use the shutdown command, let’s start by reviewing the basic syntax.
The shutdown command expressions take the following form:
shutdown [OPTIONS] [TIME] [MESSAGE]
options- Shutdown options such as halt, power-off (the default option) or reboot the system.
time- The time argument specifies when to perform the shutdown process.
message- The message argument specifies a message which will be broadcast to all users.
On the modern Linux distributions shutdown is an alias to systemctl and it is available in the system only for compatibility reasons.
How to use the shutdown command
When used with no arguments, the shutdown command will power off the machine.
The shutdown process starts after 1 minute, which is the default time interval.
How to shutdown the system at a specified time
The time argument can have two different formats. It can be an absolute time in the format
hh:mm and relative time in the format
+m where m is the number of minutes from now.
The following example will schedule system shutdown at 11 A.M:
sudo shutdown 11:00
The following example will schedule system shutdown in 10 minutes from now:
sudo shutdown +10
How to shutdown the system immediately
To shut down your system immediately you can use
+0 or its alias
sudo shutdown now
How to broadcast a custom message
To broadcast a custom message along with the standard shutdown notification type your message after the time argument.
The following example, will shut down the system in 30 minutes from now and notify the users that a hardware upgrade will be performed:
sudo shutdown +30 "Hardware upgrade"
It is important to mention that when specifying a custom wall message you must specify a time argument too.
How to reboot the system
To reboot the system after shutdown, use the
sudo shutdown -r
You can also specify a time argument and a custom message:
shutdown -r +5 "Updating kernel"
The command above will reboot the system after 5 minutes and broadcast
How to cancel a scheduled shutdown
If you have scheduled shutdown and you want to cancel it you can use the
sudo shutdown -c
When canceling a scheduled shutdown, you cannot specify a time argument, but you can still broadcast a message that will be sent to all users.
sudo shutdown -c "Canceling the reboot"
By now you should have a good understanding of how to use the Linux shutdown command. If you want to learn more about the Shutdown command visit the shutdown man page.