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 gunzip Command: Decompress gzip Files

Linux gunzip Command: Decompress gzip Files

Learn how to decompress gzip Files with the Linux gunzip command, including practical examples, key options, and important precautions.

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 Tutorial / Linux Terminal and Shell Basics: Command Syntax and Finding Help

Linux Tutorial / Linux Terminal and Shell Basics: Command Syntax and Finding Help

Learn the difference between a terminal and a shell, read command syntax and output, and use Bash help tools through a short hands-on exercise.

Linux umount Command: Unmount a Filesystem Safely

Linux umount Command: Unmount a Filesystem Safely

Learn how to unmount a Filesystem Safely with the Linux umount command, including practical examples, key options, and important precautions.

Linux join Command: Combine Files by a Common Field

Linux join Command: Combine Files by a Common Field

Learn how to combine Files by a Common Field with the Linux join command, including practical examples, key options, and important precautions.

Linux Disk Management: Partitioning, Formatting, and Mounting

Linux Disk Management: Partitioning, Formatting, and Mounting

Learn a safe Linux disk-management workflow for identifying devices, creating partitions and filesystems, mounting storage, and configuring persistent mounts.

Linux mv Command: Move and Rename Files and Directories

Linux mv Command: Move and Rename Files and Directories

Learn how to move and rename files or directories with Linux mv, avoid unwanted overwrites, clarify destination paths, and handle cross-filesystem moves.

Linux cat Command: Display and Concatenate File Contents

Linux cat Command: Display and Concatenate File Contents

Learn how to use the Linux cat command to display text files, concatenate multiple files, number lines, reveal hidden characters, and avoid unsafe redirection mistakes.

Linux umask Command: Control Default File Permissions

Linux umask Command: Control Default File Permissions

Learn how to control Default File Permissions with the Linux umask command, including practical examples, key options, and important precautions.

Linux more Command: View Text One Screen at a Time

Linux more Command: View Text One Screen at a Time

Learn how to use Linux more to read text one screen at a time, move and search interactively, start at a line or pattern, and choose between more and less.