Do not know the Halt shutdown command

Source: Internet
Author: User

I like Linux very much. In my work, I also like to sum up my experience and lessons on the Halt shutdown command. Next I will discuss in detail the analysis of the Halt shutdown command. Learning Linux is not like learning Windows. You should not only master the operation process, but also understand the principles. Beginners may face many difficulties when learning Linux, such as lack of or need to enhance basic knowledge about computer networks.

The Halt shutdown command is the boss of the six shutdown commands. Different parameters can be kept up with in this command for different purposes. In this shutdown command, there are mainly the following seven parameters.

For example, the-n parameter is mainly used to prevent sync system calls. Linux Halt shutdown command system sometimes improves efficiency, will write the data to the hard disk first to filesystem buffer. This buffer is a piece of memory space. If the data to be written to the hard disk is stored in this buffer, and the system suddenly loses power, the data will be lost. The sync command forcibly writes data stored in the buffer to the hard disk. This function is like cache in the database.

You can first write the changed data to a cache in the memory. And then write it to the hard disk at a specific time. This method can improve the system performance. However, sometimes the administrator needs to prohibit the system from using the sync command. For example, after the system administrator uses the fsck command to repair a partition, to prevent the kernel from overwriting the repaired super block with the old version, the system administrator must use the halt-n mode to shut down the kernel. In this case, the old version of the super block will not be used to overwrite the repaired super block during shutdown.

If the-w parameter is included in the halt command, it is not a real restart or shutdown. The event is recorded in the wtmp log file. As we all know, when logging on to the system, the login logon program will write some content to the utmp file and add it to the wtmp log file. During logout, The init process erases the corresponding records in the utmp file, and each byte is set to 0. Add a new record to the wtmp file.

Special record items are added to the wtmp file when the system is restarted and before and after the system time and date are changed. That is to say, the wtmp Log File tracks logon and logout events and other special changes. If the system administrator does not really want to shut down the server, but just wants to write a tag to the wtmp log file, the halt-w command can be used to complete this requirement. In addition,-d is the opposite of-w. If this parameter is added during shutdown, content will not be added to the wtmp log file during shutdown.

This command can also be used to reduce power consumption. For example, there are four power-saving modes in a laptop. The first is the Doze mode. When the set time is reached, the CPU clock slows down and other devices operate as usual. The second is Standby mode. When the set time is reached, the hard disk and display will stop working, and other devices will operate as usual. The third is the Suspend mode. When the set time reaches, all devices except the CPU will stop working. Fourth, HDD Power Down mode: when the set time is reached, the hard disk stops working, and other devices operate as usual. In the Linux Halt command system, the second mode is supported, that is, the Standby mode. If the system administrator runs the halt-h command, the hard disk of the high-speed Linux Halt shutdown command is in Standby mode to save power.

In addition, the-p parameter is the default option for this command. If this parameter is used, the command is exactly the same as the poweroff command. For details about other parameters, refer to the Help file of the system.

Note that the halt command has User restrictions. That is to say, after parsing the command line parameters, the system will call the geteuid system process to determine whether the current user is a root user. If yes, perform subsequent operations. If it is a common user, halt exits and an error message is displayed to the user.

The halt command is a powerful shutdown command. However, to some extent, it is not an Halt shutdown command. Because it can play a lot of roles other than shutdown. As a system administrator, You must select appropriate parameters based on your needs. Only in this way can the function of this shutdown command be maximized.

  1. The minimum root file is successfully created in Linux.
  2. The Linux operating system no longer supports the anteng processor.
  3. Details about Linux recovery
  4. Easily complete Linux burn CD-ROM Data CD
  5. In-depth analysis on safe installation of Fedora linux Desktop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.