3.2 "Linux learning is not difficult" Linux character Interface (2): Shutdown command to shut down and restart the Linux system
The shutdown command can safely shut down or restart the Linux system, and some users will turn off the computer using a direct power-down method, which is very dangerous. Unlike Windows, Linux systems run many processes in the background, so forcing a shutdown can cause data loss to the process, leave the system in an unstable state, and even damage hardware devices in some systems. Using the shutdown command before the system shuts down, the system administrator notifies a warning message to all logged-in users, telling them that the system is about to close and that new users cannot log on again. It is possible to shut down directly or delay a certain amount of time before shutting down, and it may be possible to restart the computer.
The shutdown command also allows the user to specify a time parameter, which can be either an exact time or a time period starting from now. The exact time format is hh:mm, which represents hours and minutes, and the time period is represented by "+" and minutes. After the system executes the command, data synchronization is done automatically.
Command syntax:
shutdown [options] [TIME] [warning message]
The meanings of the options in the command are as shown in the table.
Options |
option meaning |
-K |
Do not execute shutdown, just issue a warning message to all users |
-R |
Rebooting the system |
-H |
shutting down the system |
-C |
Cancel Run shutdown |
Example: Shut down the computer system immediately.
[Email protected] ~]# shutdown-h now
Example: Shut down the computer system after 45 minutes of timing.
[Email protected] ~]# shutdown-h +45
Example: Restart the computer system immediately and issue a warning message.
[Email protected] ~]# shutdown-r Now "system would be is reboot now."
Example: Restart the computer system at 1:38.
[Email protected] ~]# shutdown-r 01:38
This article extracts from "Linux Learning is not difficult" textbook, which is one of the most practical, theoretical and practical Linux Introductory materials. To read the entire book, visit the Linux ops (www.linuxywz.com) website .
Linux learning is not difficult "Linux character Interface (2): Shutdown command to shut down and restart the Linux system