How to Use Linux shutdown Command With Examples

By
Milica Dancuk
Published:
April 29, 2025
Topics:

All users and system administrators should know how to shut down an operating system safely. Linux has a shutdown command to help turn off the machine.

The command offers several options when shutting down a Linux system, such as scheduling at a specific time, shutting down immediately, or broadcasting a unique message to all users before the shutdown.

This guide will show you how to use the Linux shutdown command with examples.

How to Use Linux shutdown Command With Examples

Prerequisites

Linux shutdown Command Syntax

The basic syntax of the shutdown command is:

shutdown [options] [time] [message]

The command has the following parameters:

  • [options]. Controls whether to halt, power off, or reboot the machine.
  • [time]. Specifies when to perform the shutdown.
  • [message]. Adds a system-wide message that announces the shutdown.

Note: To reboot instead of shutting down the system, refer to How to Restart or Reboot Linux Server from Command Line.

Linux shutdown Command Options

The shutdown command has different options to adjust the behavior when shutting down a system. The command's options are in the table below:

OptionDescription
-H
--halt
Stops the system by halting all CPU functions.
-r
--reboot
Reboots the machine.
-P
--poweroff
Turns the machine off (default).
-k
--kmsg
Broadcasts a message to all logged-in users without shutting down.
-n
--no-wait
Terminates all processes and shuts down.
-cCancels a pending shutdown action.

Note: Use the --help option or man command to see more information about the command and its options.

Linux shutdown Command Examples

The shutdown command on Linux systems requires using the sudo command. Without any options, the shutdown command shuts down the system in 60 seconds:

sudo shutdown
sudo shutdown terminal output

The output shows the scheduled shutdown time. The sections below show advanced usage.

Note: To show the current date/time, use the date command.

How to Immediately Shut Down Linux

To immediately shut down the system, use:

sudo shutdown now

Alternatively, use the +0 time delay option:

sudo shutdown +0

Both commands immediately shut down the system.

How to Schedule a Shutdown at a Specific Time

To schedule a shutdown, add the time argument in the HH:MM format:

sudo shutdown 07:00
sudo shutdown 07:00 terminal output

The command schedules a shutdown at 7 AM.

Note: To see a list of all logged-in users, use the w command.

How to Shut Down Linux After a Delay

Another way to specify a shutdown time is to use the time delay format (in minutes). For example:

sudo shutdown +15
sudo shutdown +15 terminal output

The command schedules a shutdown in 15 minutes from now.

How to Broadcast a Custom Shutdown Message

To send a message to all users before a shutdown, add a custom text at the end:

sudo shutdown +5 "Shutdown in 5 minutes. Please save all your work."
sudo shutdown +5 broadcast message terminal output

The command schedules a shutdown in 5 minutes, informs all users, and shows the provided message in their terminal.

shutdown broadcast message terminal output

How to Broadcast a Shutdown Warning Without Shutting Down

Use the -k option to send a shutdown message to all users without shutting down the system:

sudo shutdown -k "This is a test."

The command does not show any output. The message shows to all logged-in users, but the system continues running. Use this option to notify users about upcoming maintenance or to test a broadcast message.

Note: Another way to broadcast messages to users in Linux is via the wall command.

How to Reboot the System Using shutdown

Provide the -r option to the shutdown command to reboot the system:

sudo shutdown -r now

The command immediately reboots the system.

How to Cancel Scheduled Shutdown

To cancel a scheduled shutdown, use the -c option:

sudo shutdown -c

The command doesn't show any output. To inform other users, add a broadcast message while cancelling:

sudo shutdown -c "Shutdown cancelled."

How to Halt the System Without Powering Off

The -H option halts all processes without turning off the machine:

sudo shutdown -H now

The command stops the operating system and all processes without powering off the machine.

Conclusion

This guide showed all the basic shutdown commands every Linux user should know. The command is a safe way to shut down your system and inform all users about scheduled shutdowns.

For other Linux commands, see our comprehensive lists of Linux commands all users should know.

Was this article helpful?
YesNo