shutdown Command

Purpose

Provides the capability to halt, power off, restart, or schedule a system shutdown or restart.

Syntax

shutdown [ -c ] [ -h ] [ --help ] [ -H ] [ -k ] [ --no-wall ] [ -P ] [ -r ] [ --show ] [ time ] [ wall...]

Description

The shutdown command halts, powers off, restarts, or schedules a system shutdown or restart. When the shutdown command is used without any flags, it performs the power off operation by default.

Flags

Table 1. Flags
Items Description
-c Cancels a shutdown. This option works only when a timed shutdown is scheduled with the time parameter. The time parameter value must not be now or +0.
-h Powers off the system. However, the -h option does not override an explicit --halt flag. This option is equivalent to the -P option.
--help Displays help about the shutdown command.
-H or --halt Halts the system.
-k Send the message specified by the wall parameter to all the users without halting, powering off or restarting the system.
--no-wall Suppress the message specified by the wall parameter before the system is shut down.
-P or --poweroff Powers off the system.
-r or --reboot Restarts off the system.
--show Displays any scheduled shutdown operation and the scheduled time of the operation.

Parameters

Table 2. Parameters
Item Description
time Specifies the time for a scheduled halt, power off, restart, or shutdown operation. The time parameter is optional. If the time parameter is not specified, the shutdown command waits for one minute (+1) before it performs the action.
The following options are the valid values for the time parameter:
  • +m- Specifies the time in mins. The shutdown command waits for m minutes before it performs the action.
  • now- Takes immediate action. This option is equivalent to +0.
  • hh:mm- Specifies an absolute time in 24-hour format.

If the time parameter is used, the shutdown command broadcasts a warning message to all the logged-in users. The wall parameter is used to specify the warning message. The shutdown command also blocks all the non-root user logins five minutes before the scheduled time for shutdown of the system. These actions are performed only when the time parameter is used without the now or +0 value.

wall Specifies an optional wall message. This message is sent to all the logged-in users in addition to the standard shutdown warning before the shutdown operation is performed.

Exit status

This command returns the following exit values:

Table 3. Exit status
Item Description
0 Successful completion.
Nonzero A nonzero failure code is returned when the shutdown command fails.