shutdown Command: Tutorial & Examples

Turn off or reboot the system

The shutdown command is a command-line utility used to shut down or reboot a Linux system. The shutdown command can be used to schedule a shutdown or reboot at a specific time, or to immediately shut down or reboot the system.

Here are some examples of using the shutdown command:

To immediately shut down the system, use the command:

sudo shutdown -h now

To schedule a shutdown in 15 minutes, use the command:

sudo shutdown -h +15

To reboot the system immediately, use the command:

sudo shutdown -r now

To schedule a reboot in 1 hour, use the command:

sudo shutdown -r +60

To cancel a scheduled shutdown or reboot, use the command:

sudo shutdown -c

The shutdown command can also be used to send a message to other users logged into the system, informing them that the system is going down. This can be done by using the -m option and specifying the message, like this:

sudo shutdown -h +15 "The system will be shut down for maintenance in 15 minutes"

It is important to note that the shutdown command requires superuser/root privileges, so it must be executed with sudo or by a user with root privilege. Also, running this command will logout all the users and close all the running program or applications before shutting down the system.