The correct method should be used to shut down Linux.
Windows is a single-user, "fake" task, so even if your computer is shut down, it will not affect others. However, in Linux, because every program is executed in the background, many people may work on your host at the same time behind the screen that you don't see. Otherwise, the file system may be damaged. Therefore, under normal circumstances, pay attention to the following things When shutting down:
(1) view the system usage status.
To see who is online, you can use the who command. To view the online status of the network, run the netstat-a command. The program running in the background can execute the PS-Aux command.
(2) Notify online users of the shutdown time
In this case, you can use the shutdown command.
Shutdown command:
Syntax: shutdown [-T seconds] [-arkhncff] Time Warning Message (single quotes)
-T: The following description indicates shutdown after several seconds.
-K: only a warning message is sent if the instance is not shut down.
-R: restart after the system service is stopped.
-H: Shut down immediately after the system service is stopped.
-F: force The fsck disk check to be skipped after the instance is shut down and started.
-F: After the system is restarted, force the fsck disk check.
-C: cancels the content of the shutdown command.
In addition, the restart and shutdown Commands include reboot, halt, and poweroff. In fact, the same job is done by default.
Halt calls shutdown first, while shutdown calls halt at last. However, shutdown can be stopped only after the service is disabled based on the services already started. However, halt can perform special hardware shutdown functions in the current system.
In addition, there is also a shutdown command that is INIT 0
Init is a command to switch the execution level. There are 7 execution levels in Linux, and the following four levels are important:
Run level 0: Shutdown
Run level 3: Command Line-only mode
Run level 5: graphic interface mode
Run level 6: restart