Restart commands reboot, shutdown -r

First, the role of the shutdown restart command

  I believe that for people who have been in contact with computers, especially for Windows systems, if they are used for a long time without restarting, there will be a little bit of lag. But when the whole system is restarted, the feeling of being stuck seems to be gone again. After restarting, the Windows system will reset the entire service, just like restoring the factory settings. Maybe restarting is just what it does. Also in Linux, it is necessary to shut down and restart. In Linux servers, the server is often restarted and shut down. It may be that the system needs maintenance, the new system goes online, and so on. Therefore, commands such as shutdown, reboot, and halt come in handy, which are commands that must be learned when learning Linux.

Second, the commonly used shutdown and restart commands

  (1) shutdown option time: Perform an operation at the specified time. If it is a non-root user, you need to enter the login password. The options are as follows:

    -h: shutdown

    -r: restart

    -c: cancel the previous shutdown command

  (2) Other shutdown commands:

    halt: Shut down, only the root user can use it.

    poweroff: shutdown, non-root users need to enter the login password.

    init 0: Shutdown, non-root users need to enter the login password.

  (3) Other restart commands:

    reboot: reboot, non-root users need to enter the login password.

    init 6: Restart, non-root users need to enter the login password.

3. Effect demonstration

  (1) Use the shutdown command to immediately perform the shutdown operation. The Linux command is as follows, and the effect diagram is shown in Figure 3-1, which shows that Linux is shutting down.

 

1 shutdown -h now

  

  

                  Figure 3-1

  (2) Use the shutdown command to immediately restart the shutdown operation. The Linux command is as follows, and the effect diagram is shown in Figure 3-2, which shows that Linux is restarting.

 

1 shutdown -r now

  

   

                          Figure 3-2

 

  Finally, other shutdown and restart commands will not be demonstrated. How to choose so many shutdown commands, I personally recommend the shutdown command. Because the shutdown command can specify a time to perform an operation, and the command is relatively safe and secure, it will save relevant ongoing service information, and then perform an operation.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324787205&siteId=291194637