In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "detailed introduction of the proc directory in Linux". The content of the explanation 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 "the detailed introduction of the proc directory in Linux".
1. What is proc?
Looking at the / etc/rc.d/sysinit file of LINUX F8, you can see that the following statement appears on line 21 of the script:
The code is as follows:
If [!-e/proc/mounts]; then
Mount-n-t proc / proc / proc
Mount-n-t sysfs / sys / sys > / dev/null 2 > & 1
Fi
This break means that if the / proc/mounts file exists, the proc device of the proc file system is mounted to the proc directory, and the sys device of the sysfs file system is mounted to the / sys directory. So, what exactly is the proc file system?
The proc file system is a pseudo file system that only exists in memory and does not take up out-of-memory space. It provides an interface to access the kernel data of the system in the way of file system. Users and applications can get information about the system through proc and can change some parameters of the kernel. Because the information of the system, such as the process, changes dynamically, when the user or application reads the proc file, the proc file system dynamically reads the required information from the system kernel and submits it.
2. Main directories and files of proc
Its main directory and file structure are as follows: (/ proc/)
The code is as follows:
Apm # Advanced Power Management Information
Bus # bus configuration information (the configuration of USB is also recorded here)
Cmdline # kernel command line
Cpuinfo # about Cpu information
Devices # available devices (block devices / character devices)
DMA channel used by Dma #
File systems supported by Filesystems #
Use of Interrupts # interrupts
The use of Ioports # I Dot O Port
Impression of Kcore # Kernel Core
Kmsg # kernel messages
Ksyms # Kernel symbol Table
Loadavg # load balancing
Locks # kernel lock
Meminfo # memory Information
Misc # Miscellaneous
Modules # load module list (can be thought of as a driver)
Mounts # mounted file system
Partitions # system-recognized partition table
PCI # details of each device on the PCI bus (can be viewed using lspci)
Rtc # Real-time clock
Slabinfo Slab # Pool Information
Stat # Comprehensive Statistical status Table
Utilization of swap space in Swaps #
Version # kernel version
Uptime # system uptime
In addition to the above directories, the PID numbers of the running processes on the host also exist in the / proc directory in the form of directory names. The cmdline file and the environ file are worth mentioning. The former represents the command string that starts the process; the latter is the content of the process's environment variable. They can all be viewed using the cat command.
As shown in figure 1, process 2088 is generated by the startx command, the current Xwindows mode.
Figure 1
3. What is the cmdline under the proc directory
The following code appears at line 306 of the / etc/rc.d/sysinit script:
The code is as follows:
Cmdline=$ (cat / proc/cmdline)
It means to assign the content of / proc/cmdline to the cmdline variable. The content of / proc/cmdline mentioned earlier refers to the kernel command line. Let's not dwell on what the kernel command line is, let's take a look at its contents. As shown in figure 2.
Figure 2
It can be found that its content is a discrete field. Obviously, these characters are generated by the kernel, and they represent some basic information about the running environment of the system, which is determined before the system is fully booted. These fields are like flag bits, so subsequent launches can be performed according to these "flag bits".
So who produced it? Roughly speaking, it can be said to be generated by grub. Grub (Grand Unified Bootloader) Boot Loader, which is what is read from the MBR of the first boot device after the computer has read the BIOS information. Without it, the core cannot be loaded into the system at all. There are many functions of Grub, and we don't need to know more about it for the time being. The kernel statement tells the disk MBR where to read the system kernel and where the auxiliary system boot initrd (InitalRAM Disk) impression file is located. At the same time, you can add some startup parameters, such as whether to open RHGB, whether to force scanning. These fields are all reflected in the cmdline in the kernel virtual file system / proc.
Therefore, when we need to determine whether certain services are activated when the system starts, of course we have to look at the contents of / proc/cmdline.
Thank you for your reading, the above is the "detailed introduction of the proc directory in Linux", after the study of this article, I believe you have a deeper understanding of the detailed introduction of the proc directory in Linux, the specific use of the situation also 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.