Linux shutdown Command Tutorial

The Linux and Unix systems provide the shutdown command in order to turn off or shut down the computer. Even there are different commands to shut down a Linux and Unix system the shutdown is the de facto way. The shutdown command provides some features and options which can be used to shut down a system in different ways.

shutdown Command Syntax

The shutdown command has the following syntax.

  • OPTION provides different behaviors like reboot, cancel the shutdown, etc. This is optional.
  • TIME is used to specify the shutdown time and delay. This is optional.
  • MESSAGE is used to provide messages to the other system users. This is optional.

Shutdown Linux System

The shutdown command can be only used by root or users who have root privileges via the sudo command. So in general you should provide the sudo command to use the shutdown command as a regular user with root privileges. The shutdown command shutdowns the system after 1 minute without a parameter like below.

sudo shutdown

If you want to cancel the shutdown in this 1-minute delay you can use the -c option which will cancel the shutdown which is also explained below.

Shutdown Linux At Specified Time

The Linux system can be set a specific time to shut down or turn off. The time parameter is used to specify the time we want to shut down the system. The time format is in HH:MM where the HH is an hour in 24-hour format and MM is the minutes. In the following example, we will shutdown the system at 18:00.

sudo shutdown 18:00

Shutdown Linux After Specified Time

Another useful time specification for the shutdown command is specifying the delay of the shutdown. By using the + sign with the delay minutes after the specified minutes the system will shutdown. In the following example, we will shut down the system after 15 minutes.

sudo shutdown +15

Shutdown Linux Immediately

by default Linux system waits for 1 minute for the shutdown to provide time for the current other users to save their works. But if we need to shut down the system immediately the now can be used.

sudo shutdown now

Print Message To Other Users During Shutdown

The Linux systems can be used by multiple users especially used as a server. Before shutting down the Linux system sending or broadcasting some message to the users may be very useful in order to provide information about the shutdown. The message parameter of the shutdown command can be used for this. In the following example, we will display the “Will be back in 10 minutes” message to all other Linux system users.

sudo shutdown "Will be back in 10 minutes"

Reboot with shutdown Command

Even the shutdown command is designed to be shut down to turn off the computer it can be also used to restart or reboot the Linux system. The -r option can be used to reboot systems like shutdown and start.

sudo shutdown -r

Cancel Shutdown

By default, the shutdown command provides a 1-minute delay before the shutdown. Alternatively, some time or delay can be specified explicitly for the shutdown command. Before the shutdown, we can cancel this shutdown operation by using the -c option like below.

sudo shutdown -c
Cancel Shutdown
READ  Linux /etc/login.defs Tutorial

Leave a Comment