In fact, most of the Linux domain is used on the server, rarely encountered the shutdown operation. After all, running a service on the server is endless, unless in exceptional circumstances, the last resort will be turned off.
Linux is different from Windows, under Linux, because every program (or service) is executed in the background, so there may be quite a few people working on your console at the same time behind the screen you can't see, such as browsing the web, sending letters, sending files by FTP, etc. If you just press the power switch to shut down, other people's data may be interrupted! That would be a headache! In addition, the biggest problem is that if the shutdown is not normal, it can cause file system damage (because it is too late to write data back to the file, so some service files will be problematic!) )。
If you are shutting down, you must ensure that no other users are online in the current system. Can releaseWho this directive, and if > Look at the background execution of the program can execute Ps-aux This command. Use these instructions to let you know a little about the current state of the host! (these commands will be mentioned in a later section, so just understand!)
* Sync synchronizes data from memory to the hard disk.
* shutdown shutdown instructions, you can see the help document with man shutdown. For example, you can run the following command to shut down:
* shutdown-h ' This command tells you that the computer will shut down after 10 minutes and will be displayed in the current screen of the logged-on user.
* shutdown-h now shut down immediately
* shutdown-h 20:25 The system will shut down 20:25 today
* shutdown -H +10 shut down after 10 minutes
* shutdown-r now system restarts
* shutdown-r +10 system 10 minutes after restart
*< Strong>reboot is the restart, equivalent to Shutdown-r now
* halt shutdown system, equivalent to Shutdown-h now and Poweroff
In conclusion, command to shut down has shutdown-h now, Halt, Poweroff and init 0, the command to restart the system has Shutdown-r now, reboot, Init 6.
How Linux shuts down properly