Linux Shutdown Command

 

Linux Shutdown Command.

 

   The need to make sure that your Linux system intact, you cannot power of your Linux server or your Linux system by just pulling the power plug.  Why we need to shutdown properly?  the answer simply to give the operating system a time to save their current work (operating system data) that may be on the volatile memory to the hard disk and making sure that the configuration file intact before it can be power off.  If the operating system not shutdown in proper way, the operating system files/configuration files may corrupt and you may not be able to boot up your operating system again.

 

The Linux shutdown command example below show how you can use Linux shutdown command to properly shutdown your Linux system properly.

 

Linux shutdown command example.

 

Linux shutdown command syntax:

Usage: shutdown [OPTION]... TIME [MESSAGE]

 

1.  The shutdown command below show the output example on the shutdown command that not execute properly.

 

[linux@fedora11 ~]$ shutdown

shutdown: time expected

Try `shutdown --help' for more information.

[linux@fedora11 ~]$

 

2.  You need to be root in order to execute shutdown command.

 

[linux@fedora11 ~]$ shutdown -h now

shutdown: Need to be root

[linux@fedora11 ~]$

 

Shutdown Linux immediately

 

1.  Shutdown Linux system, the command below can be use to shutdown your Linux system properly.  The -h instruct the shutdown command to halt the system and to instruct the shutdown command to shutdown the Linux system immediately, we can use the now or 0 for the time

 

Linux Shutdown Command

[linux@fedora11 ~]$ su -c 'shutdown -h now'

Password:     <-- Key in root user password and hit enter key

 

2. or put 0 for the time

Linux Shutdown

[linux@fedora11 ~]$ su -c 'shutdown -h 0'

Password:     <-- Key in root user password and hit enter key

 

Shutdown Linux on given time frame

 

1.  The example below show how to use shutdown command to shutdown Linux on given time frame.

 

Shutdown Linux system in ten minutes

shutdown linux in 10 min

[linux@fedora11 ~]$ su -c 'shutdown -h +10'

Password:     <-- Key in root user password and hit enter key

 

2.  Shutdown Linux system at 6:00 AM (24 hrs clock format)

Shutdown Linux on given time frame

[linux@fedora11 ~]$ su -c 'shutdown -h 06:00'

Password:     <-- Key in root user password and hit enter key

 

3.  Shutdown Linux system at 8:00 PM (24 hrs clock format)

Shutdown Linux system at 8:00 PM

[linux@fedora11 ~]$ su -c 'shutdown -h 20:00'

Password:     <-- Key in root user password and hit enter key

 

Shutdown Linux and send warning message to users

 

1.  The command example below show the shutdown command with the comment/warning message, or information that you want to send to the current user on the system

Shutdown Linux and send warning message to users

[linux@fedora11 ~]$ su -c 'shutdown -h 20:00 "We pull the plug at 8:00 PM today"'

Password:     <-- Key in root user password and hit enter key

 

Broadcast message from fedora11@linux.basiclinuxcommand.com

        (/dev/pts/2) at 19:38 ...

 

The system is going down for halt in 22 minutes!

We pull the plug at 8:00 PM today

 

Power off Linux and send warning message to users

 

1.  The shutdown command also can be use to power off the system, the command example below power off Linux server at 8:00 PM and send comment/warning message, or information to all user on the system

Power off Linux and send warning message to users

[linux@fedora11 ~]$ su -c 'shutdown -P 20:00 "We pull the plug at 8:00 PM today"'

Password:     <-- Key in root user password and hit enter key

 

Broadcast message from fedora11@linux.basiclinuxcommand.com

        (/dev/pts/2) at 19:40 ...

 

The system is going down for power off in 20 minutes!

We pull the plug at 8:00 PM today

 

Cancel Shutdown

 

1.  Linux cancel shutdown command that you execute earlier, press Ctrl + C key on your keyboard or use the shutdown command as show below.

Linux Cancel Shutdown

[linux@fedora11 ~]$ su -c 'shutdown -c'

Password:     <-- Key in root user password and hit enter key

shutdown: Shutdown cancelled

 

2.  Linux cancel shutdown and send message to all user about cancelation of shutdown..

Cancel shutdown and send message to users

[linux@fedora11 ~]$ su -c 'shutdown -c "The shutdown procedure on this Linux server have been CANCEL!, the system will continue to run until further notice"'

Password:     <-- Key in root user password and hit enter key

shutdown: Shutdown cancelled

 

Broadcast message from fedora11@linux.basiclinuxcommand.com

        (/dev/pts/2) at 19:44 ...

 

The shutdown procedure on this Linux server have been CANCEL!, the system will continue to run until further notice

[fedora11@fedora11 ~]$

 

Keywords: linux shutdown command, linux shutdown, shutdown linux, linux shutdown command example, shutdown linux immediately, linux cancel shutdown, cancel shutdown