Linux basics-shutdown and restart commands such as shutdown and reboot, shutdownreboot
I. Functions of the shutdown and restart command
I believe that people who have been in touch with computers, especially for windows systems, will feel a little stuck if they have been using it for a long time without restarting. However, after the entire system is restarted, it seems that the system is no longer running. After the restart, the windows system will reset the entire service, just like restoring the factory settings. Maybe the restart is just like this. In Linux, it is also necessary to shut down and restart the server. in Linux, it is often caused by restart and shutdown of the server, maintenance of the system, and launch of a new system. For example, shutdown, reboot, and halt commands can be used. This is a command that must be learned in Linux.
2. Common shutdown and restart commands
(1) shutdown option time: perform an operation at the specified time. If the user is not a root user, enter the logon password. The options are as follows:
-H: Shutdown
-R: restart
-C: cancel the previous shutdown command.
(2) Other shutdown commands:
Halt: Shut down. It can only be used by the root user.
Poweroff: Shut down. Non-root users need to enter the logon password.
Init 0: Shut down. Non-root users need to enter the logon password.
(3) other restart commands:
Reboot: restart. Non-root users need to enter the logon password.
Init 6: restart. Non-root users need to enter the logon password.
Iii. effect demonstration
(1) Use the shutdown command to immediately perform the shutdown operation. The Linux Command is as follows, as shown in Figure 3-1. The figure shows that Linux is shutting down.
1 shutdown -h now
Figure 3-1
(2) Use the shutdown command to immediately restart and shut down. The Linux Command is as follows, as shown in Figure 3-2. The figure shows that Linux is restarting.
1 shutdown -r now
Figure 3-2
Finally, other commands for shutdown and restart will not be demonstrated. I personally recommend the shutdown command for how to select so many shutdown commands. Because the shutdow command can be used to execute an operation at a specified time, and the command is relatively secure and secure, it will save the information about the ongoing service and then execute an operation.