The shutdown command in Linux shuts down your computer safely.
All users and processes will be notified, and processes are given the chance to exit safely.
The shutdown command can also reboot and bring the system to other power levels.
Syntax
shutdown [OPTION]... TIME [MESSAGE]
Options
Here are the available options for the shutdown command, straight from the manual:
Option | Description |
---|---|
-r | Requests that the system be rebooted after it has been brought down. |
-h | Requests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system. |
-H | Requests that the system be halted after it has been brought down. |
-P | Requests that the system be powered off after it has been brought down. |
-c | Cancels a running shutdown. TIME is not specified with this option, the first argument is MESSAGE. |
-k | Only send out the warning messages and disable logins, do not actually bring the system down. |
Examples
Here are some examples of shutdown, using the above options.
Some of the options are seldom used or intended for use on legacy hardware, so we’ll skip past those as you are almost certainly never going to use them.
Note that on many Linux systems, the shutdown command must be run as root, or using sudo
Shutdown the System Immediately
sudo shutdown -h now
Reboot the System Immediately
sudo shutdown -r now
Shutdown the System in 5 Minutes and Broadcast a Message To Logged In Users
sudo shutdown -h +5 "Shutting down in 5 minutes! Save your work!"
Reboot the System at 10 am with a Message
sudo shutdown -r 10:00 "Time for the scheduled 10am reboot!"
Cancel a Scheduled Shutdown
You can cancel a scheduled shutdown – with an optional message:
sudo shutdown -c sudo shutdown -c "We were going to reboot, but decided against it."
Conclusion
Shutting down your computer – you knew what it was, now you know how to do it properly from the Linux shell.