How to Use Shutdown Command in Linux, Proper way explained

Don’t you want to see the screen of your Linux machine? Either you don’t work anymore? Then you can shutdown machine like Windows operating system.

But, It is a little bit painful for the new user if he/she doesn’t have access to GUI. He/she can’t run commands randomly, that is the weakest point in Linux. You will have to run command in the proper way.

So before to bring your system down, you must know about shutdown command in Linux.

The shutdown command in Linux is used to down system securely. At the time of shutdown all logged in users and processes are notified that the system is going down, and nobody is allowed to log in.

By shutdown command in Linux you can down system immediately or you can schedule process.

Basic shutdown command syntax

$sudo shutdown [OPTIONS…] [TIME] [WALL…]

  • OPTION: – it is used for shutdown options such as halt, power-off (the default option) or reboots the system for more details visit the manual page.
  • TIME – The time argument is used to specifies the time when the shutdown process will be performed.
  • WALL… – The wall argument specifies a message which will be broadcast to all users.

Article Content

How to use shutdown command in Linux

Similar as other tools/utility, shutdown command can be used to followed by multiple options. You can see available options by using –help switch.

Command will be following:

$sudo shutdown –help

[email protected]:~$sudo shutdown --help
[sudo] password for vijay: 
shutdown [OPTIONS...] [TIME] [WALL...]

Shut down the system.

     --help      Show this help
  -H --halt      Halt the machine
  -P --poweroff  Power-off the machine
  -r --reboot    Reboot the machine
  -h             Equivalent to --poweroff, overridden by --halt
  -k             Don't halt/power-off/reboot, just send warnings
     --no-wall   Don't send wall message before halt/power-off/reboot
  -c             Cancel a pending shutdown

See the shutdown(8) man page for details.
[email protected]:~$

Do you want to power off machine only? You can do it by running shutdown command without arguments. See Example Below:

$sudo shutdown

[email protected]:~$sudo shutdown 
[sudo] password for vijay: 
Shutdown scheduled for Wed 2020-06-26 07:46:04 IST, use 'shutdown -c' to cancel.
[email protected]:~$

Shutdown command to the down system immediately

If you want to down system immediately then shutdown command followed by ‘now’ option will helpful.

You can also use +0 option for immediately shutdown

$sudo shutdown now
$sudo shutdown +0

Both commands are similar in work. You can use whatever like.

Shutdown command to the down system on specified time

The time argument has two different formats. If you want to power off the machine then use absolute time in the format hh: mm. It is considered in 24 hours.

Otherwise, you can use relative time in format +m where m is the number of minutes from now.

$sudo shutdown 16:00

[email protected]:~$sudo shutdown 16:00
[sudo] password for vijay: 
Shutdown scheduled for Wed 2020-06-26 16:00:00 IST, use 'shutdown -c' to cancel.
[email protected]:~$

The following example will schedule system shutdown in 30 minutes from now.

$sudo shutdown +30

[email protected]:~$sudo shutdown +30
Shutdown scheduled for Wed 2020-06-26 08:50:18 IST, use 'shutdown -c' to cancel.
[email protected]:~$

How to Check Scheduled Shutdown in Ubuntu 20.04

In above example, you can see, my system will shutdown at Wed 2020-06-26 08:50:18 IST.

Assume I am working for a company at the second shift, and the server is running 24 hours. My previous colleague scheduled shutdown PC for a technical issue, but he forgot to tell me about it. He also forgot the scheduled time.

What will I do now? How will I check the scheduled shutdown?

If you are fighting with such type of question then follow the given command:

[email protected]:~$sudo cat /run/systemd/shutdown/scheduled 
[email protected]:~$

But the result in microseconds, and it is not easy to convert in hours and minutes. So I am using here another script to see the result.

if [ -f /run/systemd/shutdown/scheduled ]; then
perl -wne ‘m/^USEC=(\d+)\d{6}$/ and printf(“Shutting down at: %s\n”, scalar localtime $1)’ < /run/systemd/shutdown/scheduled

See the result below

[email protected]:~$if [ -f /run/systemd/shutdown/scheduled ]; then
>   perl -wne 'm/^USEC=(\d+)\d{6}$/ and printf("Shutting down at: %s\n", scalar localtime $1)' < /run/systemd/shutdown/scheduled
> fi
Shutting down at: Wed Jun 26 08:50:18 2020
[email protected]:~$

How to cancel a scheduled shutdown

If you have changed your mind, and don’t want shutdown system at scheduled time. Then you can cancel the shutdown by running following command:

$sudo shutdown -c

[email protected]:~$sudo shutdown -c
[email protected]:~$sudo cat /run/systemd/shutdown/scheduled 
cat: /run/systemd/shutdown/scheduled: No such file or directory
[email protected]:~$

To Broadcast a Message Before Shutdown System

You are working as a system administrator a scheduled shutdown, but the users are unaware of it. So they will work without worry. If the system will be closed immediately, users will not get time to save work.

So It is important, to broadcast a custom message at the time of scheduled shutdown. It will notify all users about this scheduling.

You can use the following command to schedule shutdown the system with a custom message.


$sudo shutdown +30 “System upgrade”

Shutdown command to reboot the system

To reboot the system after shutdown, use the -r argument:

$sudo shutdown -r

You can also specify a time argument and a custom message:

$sudo shutdown -r +5 “Updating System”

The command above will reboot the system after 5 minutes and broadcast Updating System.


By now you have a good understanding of shutdown command in Linux. Access command line, and shutdown system. If you have the access of system remotely, all commands will work properly on the remote system.

I always love to reply comments, So please ask if you have any question in the comment box

Thanks for Reading!


If Appreciate My Work, You should consider: