The shutdown command can be used to shutdown, poweroff, halt, or restart the operating system. The shutdown command without any options will display time expected, as the shutdown time is required.
[root@server1 ~]# shutdown
shutdown: time expected
Shut down immediately
The shutdown command followed by the word now will shut down the machine immediately. Similarly, the init 0, telinit 0, and poweroff commands will also shut down the machine immediately.
[root@server1 ~]# shutdown now
Shut down in n minutes
The shutdown command followed by an integer will shut down the machine in n minutes. In this example, the machine will shut down in 5 minutes.
[root@server1 ~]# shutdown 5
Add a message
Text can be added to give other signed in users a warning that the machine will be shut down.
[root@server1 ~]# shutdown 5 "Urgent - This machine will shut down in five minutes!"
Broadcast message from root@server1
(/dev/pts/2) at 21:01 ...The system is going down for maintenance in 5 minutes!
Urgent - This machine will shut down in five minutes!
The -k option can be used to send a message to other signed in users warning that the machine will go down, but to not actually bring the machine down.
[root@server1 ~]# shutdown -k "Urgent - This machine will shut down very soon!"
Broadcast message from root@server1
(/dev/pts/2) at 21:01 ...The system is going down for maintenance in 5 minutes!
Urgent - This machine will shut down very soon!
Cancel a shut down
The Ctrl C command can be used to cancel the scheduled shutdown.
^C
shutdown: Shutdown cancelled
Or, using another Terminal, the shutdown command with the -c option can be used to cancel the scheduled shutdown.
[root@server1 ~]# shutdown -c
Reboot
The -r option can be used to reboot the machine immediately. The reboot, init 6, and telinit 6 commands can also be used to reboot the machine immediately.
[root@server1 ~]# shutdown -r
The -r option followed by an integer can be used to reboot the machine in n minutes. In this example, the machine will reboot in 5 minutes.
[root@server1 ~]# shutdown -r 5
Broadcast message from root@server1 (/dev/pts/2) at 21:01
...
The system is going down for reboot in 5 minutes!
Halt
The -h option can be used to halt the machine immediately. The halt command can also be used to halt the machine immediately.
[root@server1 ~]# shutdown -h
The -h option followed by an integer can be used to halt the machine in n minutes. In this example, the machine will halt in 5 minutes.
[root@server1 ~]# shutdown -h 5
Broadcast message from root@server1
(/dev/pts/2) at 21:01
...
The system is going down for halt in 5 minutes!
Poweroff
The -P option can be used to power off the machine immediately. The poweroff command can also be used to power off the machine immediately.
[root@server1 ~]# shutdown -P
The -P option followed by an integer can be used to power off the machine in n minutes. In this example, the machine will power off in 5 minutes.
[root@server1 ~]# shutdown -P 5
Broadcast message from root@server1
(/dev/pts/2) at 21:01
..
The system is going down for power off in 5 minutes!
Did you find this article helpful?
If so, consider buying me a coffee over at