The correct way to shutdown Linux

I haven't started yet, just read books.

What Linux does not recommend is to turn off the power directly. There may be many people working in the Linux background, and turning off the power directly may cause file damage.

Before shutting down normally, you should do two things: 1. Check who is online; 2. Notify others. Notifying others can be achieved through the shutdown command.

who //check online
  1. shutdown

  Commands are generally: shutdown; halt; poweroff

The general recommendation is to use shutdown. As for its usage, you can query it with the command: man shutdown. In order to ensure that the data has been written to the disk, it is best to enter several times before the shutdown command: sync. The reason is that the data that has been loaded in the memory will not be directly written back to the hard disk, which is to speed up the reading of the data. Take speed.

Shutdown can also be achieved by switching the execution level: init 0 .

   2. Reboot

  The command is generally: reboot; shutdown -r [accurate time]

The key is under root authority. The way to obtain root authority is: su root, and then enter the corresponding password.

 

Ref:

"Brother Bird's Linux Private Kitchen Basic Learning (Third Edition)"

https://www.cnblogs.com/wanggd/archive/2013/07/08/3177398.html

Guess you like

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