In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the running level of the Linux system". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what the running level of the Linux system is".
1. Introduction to the running level of Linux system
Linux has seven runlevels by default, and the Linux system runs at a specified runlevel at all times. Different running levels run different programs and services, and the work to be done and the goals to be achieved are also different.
0: turn off the phone.
1: single-user mode, which can be thought of as the security mode of Windows system, is mainly used for system repair.
2: incomplete command line mode (command line mode is the command interface), without NFS service (a service of file sharing between Linux system and Linux system).
3: the full command-line mode is the standard character interface (this is the command-line mode we've been using before).
4: the system is reserved.
5: graphic mode.
6: restart.
2. View the run level
On a Linux system, you can use the runlevel command to view the runlevel of the system.
The command is as follows:
# N represents which level was the last before entering this level. 3 represents the current level [root@localhost ~] # runlevel N 3
Description:
N means None, that is, the system is booted directly into the 3 run level, there is no previous run level. If you switch from a graphical interface to a character interface, and then look at the running level, it should be 5 / 3.
3. Modify the running level of the current system
Just use the init command. Note: this is not an init process.
The command is as follows:
Enter the graphical interface, of course, the Linux system has been installed with a graphical interface to enter.
[root@localhost ~] # init 5 shutdown
[root@localhost ~] # init 0 restart
[root@localhost ~] # init 6
Description:
If we do not install the graphical interface and execute the init 5 command, there will be no response on the remote terminal, but in the virtual machine, we will be prompted as follows: the attempt to start the graphical interface runtime failed.
But when we query the running level of the current Linux system and execute the runlevel command, the result is 3 / 5. Keep in mind that this is an illusion, we have not entered the graphical interface level.
Note, however, that using the init command to perform shutdown and restart is not too secure and can easily lead to data loss. Therefore, it is recommended that you use the shutdown command for shutdown and restart.
4. Default running level of the system
Now that we know what the running level of the Linux system is, we draw our attention back to the process of booting the system.
The default run level of the system is the run level that the system enters directly after startup. What is said above is to view the current running level of the system, rather than the default running level of the system.
The default run level of the Linux system is configured in the / etc/inittab configuration file, which contains the following contents:
As you can see from the image above, a lot of the information in it has been put into different files.
Description:
/ etc/inittab configuration file in previous Linux releases, such as Red Hat 5 or previous, / etc/inittab configuration file is a very important configuration file during system startup, and the data in it needs to be loaded. However, after Red Hat 6, the functionality of the / etc/inittab configuration file has been weakened.
So in Red Hat 6, the only function of the / etc/inittab configuration file is to configure the default run level of the Linux system. The position of the number 3 in the middle of the id:3:initdefault:: is to configure the default running level of the Linux system, and the number of letters is the corresponding level.
Note:
As noted in the run-level description of the following figure, levels 0 and 6 cannot be set to the system default run level, you can only select the system default run level from 1-5. However, it is recommended that the default runlevel of the system can only be 3 or 5, and the other levels are either shutdown and restart, or reserved or single-user, which cannot be used as the default runlevel of the system.
5. / etc/rc.d/rc.local file description
The / etc/rc.d/rc.local configuration file is a very important file, which is read before the user logs in, and what commands are written in this file will be executed every time the system boots. In other words, if I have any work that needs to be run at system startup, I only need to write / etc/rc.d/rc.local this configuration file, such as some services need to be started when booting, you can configure the complete service startup command here. (note that it is best not to write service startup mode, write / etc/init.d/ path to start)
The content of / etc/rc.d/rc.local configuration file is as follows:
You can see that the / etc/rc.d/rc.local file is a shell script, touch a very hidden file / var/ lock/ subsys/local file. (touch command: creates a file if it does not exist, and modifies the access time of the file if it exists. )
In other words, every time the system starts up, it comes to look for this very hidden file, so the modification time of this file is the startup time of the system. In other words, the purpose of this command is to get the startup time of the system.
At the same time, note that the / etc/rc.d/rc.local configuration file also has a soft link file, which is the / etc/rc.local configuration file. (two files are equivalent to one file, and you can modify either one.
The relationship between / etc/rc.d/rc.local configuration file and / etc/rc.local configuration file is shown in the following figure:
Thank you for your reading, the above is the content of "what is the running level of the Linux system". After the study of this article, I believe you have a deeper understanding of the running level of the Linux system, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.