shutdown command: Shutdown or reboot the Linux system
shutdown command Function Description
Use the shutdown command to safely shut down or restart your Linux system.
By using the shutdown command before the system is shut down, the system administrator will notify a warning message to all logged-in users that the system will be shut down and the login process will be frozen, i.e. new users will not be able to log in again.
A direct shutdown or a delay of a certain amount of time before shutting down is possible, as well as a reboot.
The shutdown command also allows the user to specify a time parameter, which can be either a precise time or a time period from the present. The format of the precise time is hh:mm for hours and minutes, and the time period is represented by a "+" and a number of minutes.
shutdown command Syntax
shutdown [Option] [Time] [Warning Message]
Option Meaning
The meanings of the options in the command are shown below.
Option | Description |
---|---|
-k | It doesn’t perform a shutdown, it just sends a warning message to all users |
-r | Reboot the system |
-h | Shutdown System |
-c | Cancel running shutdown |
shutdown command Demo
Shut down the computer system immediately
[root@deepinout ~]# shutdown -h now
Shutting down the computer system after a timer of 45 minutes
[root@deepinout ~]# shutdown -h +45
Broadcast message from root@rhel (/dev/pts/1) at 1:08 ...
The system is going down for halt in 45 minutes!
Reboot the computer system immediately with a warning message
[root@deepinout ~]# shutdown -r now "system will be reboot now."
Broadcast message from root@rhel (/dev/pts/1) at 1:08 ...
The system is going down for reboot NOW!
system will be reboot now.
Timed restart of computer system at 1:38
[root@deepinout ~]# shutdown -r 01:38
Broadcast message from root@rhel (/dev/pts/0) at 1:37 ...
The system is going down for reboot in 1 minute!