Linux shutdown Command Explained [ With 5 Examples]

Last updated: August 19, 2023 | Subhash Chandra

The shutdown command in Linux is used to power down a Linux system, ensuring that data remains intact and services end gracefully. You can also use shutdown command (using -r option) to reboot the system.

You can use the shutdown command to turn off the system immediately or at a specific time.

When a shutdown is initiated in Linux, a series of events is triggered to ensure a safe and orderly system shutdown. This includes broadcasting messages (Notifying all logged-in users), sending signals to processes, preventing new logins, unmounting file systems, deactivating the swap, network shutdown, power operations, etc.

In this tutorial, we learn about shutdown command in Linux with examples.


The basic syntax of shutdown command:

shutdown [option] [time] [message]

While the command can be issued with various options, time values, and warning messages.

Useful Shutdown Commands

The following table shows an overview of useful shutdown commands:

shutdownSchedule shut down (power down) the system in one minute.
shutdown nowThe system will shut down immediately and power off the machine
shutdown -h nowSame as above. Just explicitly mention halt. All modern systems for halt simply power off the system.
shutdown -h <time>Specifies when you want the shutdown (power off) to occur.
shutdown -PMost modern systems do same as the -h option. Power off the system.
shutdown -cCancels a scheduled shutdown.
shutdown -rReboots the system in one minute.
shutdown -r <time>Reboots the system at a specified time.
shutdown -r nowReboots the system immediately.

Shutdown Command Options

The following examples show you some of the most common usages of Linux shutdown command:

1. Shutdown After 1 Minute

Use shutdown without any options to shut down the system after one minute. This is the default behavior of the shutdown command.

sudo shutdown
shut down (power off) a Linux system after 1 minute

This will schedule a shutdown (power down) in 1 minute, and a broadcast message will be sent to all logged-in users notifying them of the impending shutdown. If you change your mind not to shutdown, you can use the shutdown -c command to cancel the schedule.

All modern systems generally support ACPI (Advanced Configuration and Power Interface) support, when you initiate a shutdown from the operating system, the system can send a signal to the hardware to begin a controlled power-off sequence. Then to start you need either physically press the power button on the computer/server or should have remote power control.

2. Shutdown Now

To do an immediate shutdown, use the Linux shutdown command with now option.

sudo shutdown now

Instead of using the time to now, you can use +0 time option to down the system immediately.

sudo shutdown +0

On a systemd based Linux Distributions the shutdown now equivalent command is systemctl poweroff. In those systems, shutdown command is a symbolic link systemctl.

3. Shutdown at a Specified Time

You can instruct the system to shut down at an absolute or relative time.

The absolute time is specified in a 24-hour HH:MM format. For example, to shut down the system at 11:30 PM, specified as:

sudo shutdown 23:30
schedule shut down at 11:30 PM

This command will shut down the system at 11:30 PM.

The relative time is mentioned in minutes with prefixed with a + symbol. For example:

sudo shutdown +5
Linux system shut down to occur in 5 mins

This command will schedule a shutdown to occur in 5 minutes from now.

Note: Five minutes before the actual shutdown time, the system prevents new user logins. This is done by creating the /etc/nologin file. When this file exists, non-root users cannot initiate new login sessions.

You can broadcast a custom message to all logged-in users notifying them of the impending shutdown and providing a reason. Example:

sudo shutdown +30 "System is going under maintenance in 30 minutes"
initiate shut down a Linux system to occur in 30 minutes with a message

This command will schedule a system shutdown to occur in 30 minutes, and it will broadcast the message "System is going under maintenance in 30 minutes".

4. Cancel a Scheduled shutdown

There may be a situation where you must cancel a scheduled shutdown. For example, suppose there is a planned release and you need to hold off the shutdown. In that case, you can cancel it using the -c option with the shutdown command.


sudo shutdown -c

This command will cancel a previously scheduled shutdown in Linux. The system will broadcast a message to all logged-in users that the scheduled shutdown has been canceled, ensuring users are aware of the changed system status.

Optionally, you can also provide a reason for the cancellation after the -c option:

sudo shutdown -c "Cancelling the shutdown due to deployment"

Note: On a systemd system the systemctl command doesn't have a schedule or cancel the shutdown. Another option is to add cron to /run/systemd/shutdown/scheduled script.

5. Shutdown command to reboot

The shutdown command is generally used to power off the system. But you can use -r option with shutdown command for rebooting the system.

Use shutdown -r command reboots the system after one minute. To reboot immediately use the following shutdown command:

sudo shutdown -r now

This command performs an immediate reboot of a Linux system. This will gracefully shut down processes, unmount filesystems, and restart the machine without cutting the power. Basically performs a warm reboot.

With that note, you may also schedule a reboot with a custom message to all logged users. Example:

sudo shutdown -r +10 “Rebooting for maintenance”
Using shutdown command to schedule a system reboot with a message

This command schedules a reboot of the Linux system in 10 minutes and sends a message to all logged-in users informing them about the reason.



Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment