UNIX / Linux shutdown Command Examples

What is shutdown?
5 shutdown examples
Syntax and Options
Related Commands

What is shutdown?

Shutdown the system in a safe way. You can shutdown the machine immediately, or schedule a shutdown using 24 hour format.

After bringing down the system, shutdown command halts or reboots the system according to the option that is specified. Only root user can execute shutdown command.

5 shutdown Examples

Shutdown the machine immediately

You can shutdown the machine immediately using the following command. It notifies all the logged in users about the system going down, and shuts down the machine.

# shutdown -h now

Broadcast message from sathiya@sathiya-laptop
	(/dev/pts/1) at 11:28 ...

The system is going down for halt NOW!

Reboot the machine immediately

You can reboot the machine immediately using the following command. It notifies all the logged in users about the system reboot.

# shutdown -r now

Broadcast message from sathiya@sathiya-laptop
	(/dev/pts/1) at 11:28 ...

The system is going down for reboot NOW!

Shutdown the machine with user defined message

You can also displays your own custom shutdown message. Along with the system message, your message will be appended in the broadcast as shown below.

# shutdown -h now 'System is going down for replacement of primary memory'

Broadcast message from sathiya@sathiya-laptop
	(/dev/pts/1) at 11:28 ...

The system is going down for halt NOW!
System is going down for replacement of primary memory

Scheduling the shutdown with 24 hour format

Schedule shutdown for 8 PM.

# shutdown -h 20:00

It sends the following message immediately to all terminals.

Broadcast message from sathiya@sathiya-laptop
	(/dev/pts/3) at 10:25 ...

The system is going down for halt in 575 minutes!

Similar to shutdown (halt), you also schedule a reboot at a specified time as shown below.

# shutdown -r 20:00

Broadcast message from sathiya@sathiya-laptop
	(/dev/pts/3) at 10:27 ...

The system is going down for reboot in 573 minutes!

Cancel a running shutdown

You can cancel the running shutdown by using -c option as,

# shutdown -c

Syntax and Options

shutdown [OPTION]… TIME [MESSAGE]

Short Option Option Description
-r Requests that the system be rebooted after it has been brought down
-h Requests that the system be either halted or powered off after it has been broughtdown, with the choice as to which left up to the system
-H Requests that the system be halted after it has been brought down
-P Requests that the system be powered off after it has been brought down
-c Cancels a running shutdown. TIME is not specified with this option, the firstargument is MESSAGE
-k Only send out the warning messages and disable logins, do not actually bring thesystem down


Related Commands

reboot
init

Comments on this entry are closed.

  • Su September 10, 2013, 10:28 am

    Hi….im trying to shutdown by just entering ‘shutdown’.But its not working.It says:
    shutdown: time expected
    Try ‘shutdown —help’ for more information.
    Can you pls help..

  • artickl September 27, 2013, 10:10 pm

    @Su:
    just run `shutdown -h now` to power off or `shutdown -r now` to reboot

  • Raja January 29, 2014, 2:02 am

    Hi….im trying to shutdown by just entering ‘shutdown -h now’. But its not working.It says:
    shutdown: Need to be root

  • Vlad January 29, 2014, 8:53 am

    Raja, you have to put “sudo” before command, if it needs to be root. So your command will be like this: “Sudo shutdown -h now”. Then, it will ask the password of your root. Put it down and *ENTER* 🙂

  • akhilesh February 5, 2014, 5:33 am

    hie i was trying to shutdown my friend pc by linux which we both connected to one server how to make it explain me

  • J.Kumar March 10, 2014, 7:53 pm

    i want to shut down my linux server from another user e.g. shut (user name). I want to give this user root’s permission for shutdown my linux server only. please help me.