shutdown: command to shutdown a Linux/ Unix machine

The shutdown command used to root privilege to perform the shutdown a linux / Unix machine, it supports a time argument. This is generally used for scheduled maintenance and give more time for users to react on the warning when a system shutdown has been scheduled .

There are many options used with shutdown command. With the help of these options we are halt,reboot and poweroff the linux machine.

==>If you want to shutdowna linux machine  immediatly

[root@localhost ~]# shutdown -h now

Note: The now keyword is an alias for + 0

==> To Halt the linux machine with ‘shutdown’ command ,you can use ‘ shutdown ‘ command with ‘ -H’ or ‘ –halt ‘ option.

[root@localhost ~]#  shutdown -H
Shutdown scheduled for Tue 2018-01-09 12:11:13 IST, use ‘shutdown -c’ to cancel.
[root@localhost ~]#
Broadcast message from root@localhost.localadmin (Tue 2018-01-09 12:10:13 IST):

The system is going down for system halt at Tue 2018-01-09 12:11:13 IST!

[root@localhost ~]#

==>If you want to poweroff a Linux / Unix machine with a specific time , you can use ‘shutdown ‘ command with ‘ -P ‘ or ‘ –poweroff ‘ option.

[root@localhost ~]# shutdown -P +10 ” The system is shutdown after 10 minute due to hardware replace “
Shutdown scheduled for Thu 2018-01-04 12:27:43 IST, use ‘shutdown -c’ to cancel.
[root@localhost ~]#
Broadcast message from root@localhost.localadmin (Thu 2018-01-04 12:17:43 IST):

The system is shutdown after 10 minute due to hardware replace
The system is going down for power-off at Thu 2018-01-04 12:27:43 IST!

[root@localhost ~]# 

==>If you want to reboot a linux machine with ‘ shutdown’ command , you can use ‘ shutdown ‘ command with ‘-r ‘ or ‘ –reboot ‘ option.

[root@localhost ~]# shutdown -r
Shutdown scheduled for Tue 2018-01-09 12:45:34 IST, use ‘shutdown -c’ to cancel.
[root@localhost ~]#
Broadcast message from root@localhost.localadmin (Tue 2018-01-09 12:44:34 IST):

The system is going down for reboot at Tue 2018-01-09 12:45:34 IST!

[root@localhost ~]# 

==>If you don’t want to halt/power-off/reboot the linux machine only send warning  message to logged in users , you can use ‘ k’ option with shutdown command .

[root@localhost ~]# shutdown -k +10 ” please save your work system shutdown after 10 minute”
Shutdown scheduled for Tue 2018-01-09 13:09:00 IST, use ‘shutdown -c’ to cancel.
[root@localhost ~]#
Broadcast message from root@localhost.localadmin (Tue 2018-01-09 12:59:00 IST):

please save your work system shutdown after 10 minute
The system is going down for power-off at Tue 2018-01-09 13:09:00 IST!

[root@localhost ~]# 

==>If you don’t send wall message before halt/power-off/reboot, you can use shutdown command with ‘ –no-wall ‘ option

[root@localhost ~]# shutdown –no-wall +10 “shutdown your system after 10 minutes.”
Shutdown scheduled for Tue 2018-01-09 14:29:02 IST, use ‘shutdown -c’ to cancel.
[root@localhost ~]#

==>If you want to cancel Linux / Unix pending shutdown  , you can use ‘ shutdown ‘ command with ‘ -c ‘ option .

[root@localhost ~]# shutdown -c

Broadcast message from root@localhost.localadmin (Tue 2018-01-09 14:19:37 IST):

The system shutdown has been cancelled at Tue 2018-01-09 14:20:37 IST!

[root@localhost ~]#

All command line options  used with the ‘ shutdown ‘ command are shown below

______________________________________________________________________________

Options                                                  Description

_______________________________________________________________________________
-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

________________________________________________________________________________

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s