In this post, I will cover the Linux shutdown command so you can know the many different ways you can shutdown your system.
The Linux shutdown command
The Linux shutdown command does more than just shut down the computer. I will cover all that the command covers. In older linux/unix systems there used to be three separate commands that would halt, reboot, or shutdown your computer. Now there is a single command that has many options to accomplish these processes.
Just shutdown the computer
If you just want to shutdown your computer now then run this command.
$ shutdown -P now
This will poweroff ( -P or –poweroff ) your system now.
Rebooting the computer
The Linux shutdown command can also be used to reboot the computer.
$ shutdown -r now
This will reboot the computer now.
Delaying the Shutdown or Reboot
Notice in all the commands above there is the now option? You can change this to delay the action (reboot/shutdown/halt) for a certain amount of time or at a set time or now.
You set a time in the HH:MM format in 24 hour time. For example, if you wanted to shutdown your computer at 10p you would use this command:
$ shutdown -P 22:00
You can also specify how many minutes from now you want the computer to shutdown. For example, to tell the system to shutdown 18 minutes from now you would use this linux shutdown command:
$ shutdown -P +18
Sending a message to all users
By default the linux shutdown command sends a message to all users called the wall message. Here is an example of the default wall message sent to all users.
You can customize the wall message that gets sent out by adding it to the end of the command:
$ shutdown -r +20 I am groot
This will show “I am groot” to all users letting them know that the system is about to reboot.
If you don’t want a message to be sent you can add the –no-wall message.
$ shutdown -r now --no-wall
You can also write something to the wall without rebooting, shutting down or halting the system. You still have to say what time to send the message. You also have to be root to send this command.
# shutdown -k now All in all its just another brick in the wall
Cancel a shutdown, reboot or halt
If you scheduled a shutdown, reboot or halt you can cancel it with the -c option
$ shutdown -c
I hope you have enjoyed this article, if so please leave a comment below. For more articles, please signup for the AdminTome Blog below. Also please feel free to share the article to your friends using the buttons to the left. Thanks again for reading this post.