In this tutorial, we will show you how to use the
shutdown command through practical examples and detailed explanations of the most common
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.
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 recent Linux distributions
shutdown is an alias to
systemctl and it is available in the system only for compatibility reasons.
How to Use the
Only the root and users with
sudo privileges can use
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, 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"
shutdown command allows you to halt, power-off and reboot your Linux system.
To learn more about
shutdown, visit the shutdown man page.
If you have any questions or feedback, feel free to leave a comment.