0% found this document useful (0 votes)
14 views

Linux shutdown Command with Examples

The document provides a comprehensive guide on using the Linux shutdown command, detailing its syntax, options, and examples for various shutdown scenarios. It covers immediate shutdowns, scheduled shutdowns, broadcasting messages, and rebooting the system. The guide emphasizes the importance of safe shutdown practices for users and system administrators.

Uploaded by

Zac Ing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Linux shutdown Command with Examples

The document provides a comprehensive guide on using the Linux shutdown command, detailing its syntax, options, and examples for various shutdown scenarios. It covers immediate shutdowns, scheduled shutdowns, broadcasting messages, and rebooting the system. The guide emphasizes the importance of safe shutdown practices for users and system administrators.

Uploaded by

Zac Ing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

https://phoenixnap.

com/kb/linux-shutdown-command

Home » KB » SysAdmin » How to Use Linux shutdown Command With Examples


How to Use Linux shutdown Command With Examples
By Milica Dancuk Published: April 29, 2025
Topics: Commands, Linux

All users and system administrators should know how to shut down an operating system safely. Linux has a shutd
own 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.

Prerequisites
• Access to the command line/terminal.
• Root or sudo privileges.

Linux shutdown Command Syntax


The basic syntax of the shutdown command is:

shutdown [options] [time] [message] Copy

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:

Option Description
-H
--halt Stops the system by halting all CPU functions.

-r Reboots the machine.


--reboot
-P Turns the machine off (default).
--poweroff
-k Broadcasts a message to all logged-in users without
--kmsg shutting down.
-n Terminates all processes and shuts down.
--no-wait
-c Cancels 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 Copy

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 Copy

Alternatively, use the +0 time delay option:

sudo shutdown +0 Copy

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 Copy

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 Copy

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." Copy

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

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." Copy

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 Copy

The command immediately reboots the system.


How to Cancel Scheduled Shutdown
To cancel a scheduled shutdown, use the -c option:

sudo shutdown -c Copy

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

sudo shutdown -c "Shutdown cancelled." Copy

How to Halt the System Without Powering Off


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

sudo shutdown -H now Copy

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.

You might also like