
Shutdown command is used to bring the system down in a safe and secure way. When the shutdown process is initiated, all the logged in users are notified that the system is going down right now or after some time. Using this command you can set specific time to make down your system.
Shutdown Command Syntax
Before going to ahead to learn how to use shutdown command, you should know the basic syntax.
Below is the basic syntax for the shutdown utility:
shutdown [OPTIONS] [TIME] [MESSAGE]
Here,
- options – You can use Shutdown options like halt, power off or reboot the system.
- time – It specifies that when shutdown process should perform.
- message – Set the message which you want to show to all users before start shutdown process.
How to use Shutdown Command
If you will issue shutdown command without any option then it will considered default(power off) option and power off the machine.
sudo shutdown
Once you will execute above command system will shutdown within 1 minute which is default time interval. You will see output as below:
Shutdown scheduled for Wed 2019-05-02 17:24:27 EDT, use 'shutdown -c' to cancel.
Shutdown System Immediately
By default, shutdown interval time is 1 minute but you can skip that delay and shutdown immediately using now as time argument. To do so use below command:
sudo shutdown now
It will immediately shutdown your system without any message or notification.
How to Shutdown System At Specified Time
Time argument is used to shutdown system at specific time. You can specify time argument in two different format: hh:mm for relative and +m for number of minutes. By using these formats you can schedule a shutdown at specific time.
Below command will schedule shutdown at 04:00 AM :
sudo shutdown 04:00
Following will schedule shutdown after 15 minutes from now:
sudo shutdown +15
Broadcast a Custom Message
Using message argument you can broadcast a custom message to all the users when performing the shutdown process. It important to specify time argument when broadcasting a message.
In below example, system shutdown in 15 minutes from now and notify users that maintenance will perform.
sudo shutdown +15 "Maintenance"
Cancel the Shutdown
If you have already scheduled shutdown and want to cancel then you can do it using the -c argument. It will cancel shutdown process immediately.
Run the below command to cancel scheduled shutdown:
sudo shutdown -c
At the time of cancellation you can not specify time argument but you can broadcast a custom message. Execute below command:
sudo shutdown -c "Canceled shutdown"
How to Reboot System
Using -r argument you can reboot the system. Run the below command:
sudo shutdown -r
Also, you can specify time and custom message as below:
shutdown -r +5 "Update System"
Conclusion
Finally, you have learned use of shutdown command in Linux with different arguments. Learn more by visit the shutdown man page.
If you have any questions, you can leave a comment below.
Leave a Reply