Linux shutdown Command: Schedule a Shutdown or Restart

shutdown schedules a system power-off or restart immediately or at a specified time. It is useful for giving server users time to prepare and for canceling scheduled tasks if necessary.

What is the shutdown command?

In the systemd implementation, the default action is power-off, and if the time is omitted, it usually executes after 1 minute. now means immediately, +10 means after 10 minutes, and -r means restart. A scheduled shutdown can be canceled before execution with -c.

Basic syntax

sudo shutdown [option] [time] [message]

The installed implementation and options may vary depending on the distribution. Check the description for your current system with man shutdown.

Examples

Schedule shutdown in 10 minutes

Gives users time to finish their work and schedules the shutdown.

sudo shutdown +10 'Shutting down for maintenance in 10 minutes'

Schedule restart in 10 minutes

If a restart is needed, specify -r.

sudo shutdown -r +10 'Restarting the server in 10 minutes'

Cancel Reservation

Cancel before the reserved time and notify the user of the change.

sudo shutdown -c

Flow to check reservations and cancellations

shutdown can schedule a shutdown or reboot for later. The following are commands to schedule a reboot in 10 minutes and to cancel it, and should not be run on a production server for testing.

sudo shutdown -r +10
sudo shutdown -c

When scheduling, a message notifying other logged-in users of the planned shutdown time may be displayed. The output text varies depending on the distribution and session, so do not expect a fixed string.

-r is for reboot, -h is for shutdown. To cancel a scheduled shutdown, run shutdown -c before the reboot starts. Even after cancellation, a separate automation may reschedule the reboot, so in a real production environment, check the change management records and service status together.

Main Options and Format

Options/Format Description
now Execute immediately.
+N Execute after N minutes.
-r Restart instead of shutting down.
-P Specify shutdown.
-c Cancel a pending shutdown reservation.
--show Display the reservation status on supported systemd versions.

Precautions when using

The example will actually shut down or restart the server, so do not run it carelessly for learning purposes. Review the target tasks, users, services, and scheduled times, and prepare a means to access the console. shutdown -c only applies to scheduled tasks that have not yet been executed. Options and default behavior may differ depending on the implementation, so check the help for your current system.

Frequently Asked Questions

Can a scheduled shutdown be canceled?

You can cancel it by running sudo shutdown -c before the scheduled time. If the shutdown process is already in progress, cancellation cannot be guaranteed.

Official Documentation

The exact behavior of options and implementation differences can be found in the official documentation on shutdown.

More in This Category
Linux Tutorial / Standard Input, Output, Redirection, and Pipes

Linux Tutorial / Standard Input, Output, Redirection, and Pipes

Understand standard input, output, and error; practice file redirection and pipes; and learn why overwrite risk and redirection order matter.

Linux tmux Command: Detach and Reattach Terminal Sessions

Linux tmux Command: Detach and Reattach Terminal Sessions

Learn how to detach and Reattach Terminal Sessions with the Linux tmux command, including practical examples, key options, and important precautions.

Linux sftp Command: Transfer Files Securely over SSH

Linux sftp Command: Transfer Files Securely over SSH

Learn how to use the Linux sftp command to transfer and manage files securely through an SSH connection, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux chmod Command: Change File and Directory Permissions

Linux chmod Command: Change File and Directory Permissions

Learn how to change File and Directory Permissions with the Linux chmod command, including practical examples, key options, and important precautions.

Linux su Command: Switch User Accounts and Login Shells

Linux su Command: Switch User Accounts and Login Shells

Learn how to use the Linux su command to switch user accounts and start login or non-login shells, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux Tutorial / File System Basics: Paths and Key Directories

Linux Tutorial / File System Basics: Paths and Key Directories

Understand the Linux directory tree, read absolute and relative paths, and learn what common directories such as /home, /etc, and /var are used for.

Linux reboot Command: Restart the System Safely

Linux reboot Command: Restart the System Safely

Learn how to restart the System Safely with the Linux reboot command, including practical examples, key options, and important precautions.

Essential Linux Commands: A Practical Reference by Task

Essential Linux Commands: A Practical Reference by Task

Browse essential Linux commands by task, including help, files, text processing, permissions, processes, networking, packages, storage, and system administration.

Linux grep Command: Search Text and Filter Command Output

Linux grep Command: Search Text and Filter Command Output

Learn how to use the Linux grep command to search files for text or regular expressions and filter command output, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux resolvectl Command: Inspect systemd DNS Resolution

Linux resolvectl Command: Inspect systemd DNS Resolution

Learn how to inspect systemd DNS Resolution with the Linux resolvectl command, including practical examples, key options, and important precautions.