/Proc/File System in Linux

Source: Internet
Author: User
The proc file system is a real-time, memory-resident file system that tracks the running status of processes on your machine and the status of your system. The/proc file system is a dynamic data that is resident in the virtual memory and maintains the operating system. Most of the/proc file system information is updated in real time to be consistent with the current operating system status. /The content of the proc file system can be read by anyone with the corresponding permissions. However, a specific part of the/proc file system can only be read by the owner and root user of the process. The content of the/proc file system is obtained and displayed from a specific/proc Directory, which has many purposes.
The following is an example of a proc file system. It can be seen that there are many numbers in the proc file system, and other information is relatively easy to understand, this article mainly analyzes the numerical information in the proc directory. # Cd proc # ls
1 4 9 diskstats iomem meminfo self uptime
10 5 97 driver ioports MISC slabinfo version
114 6 buddyinfo execdomains IRQ mounts stat vmstat
126 7 bus filesystems kcore MTD swaps zoneinfo
128 8 bytes line FS kmsg net sys
2 85 cpuinfo ide loadavg partitions sysvipc
3 88 devices interrupts locks PCI tty
The numeric directories listed above represent processes that are running on machines when we take a snapshot of the/proc file system. Let's take a look at the content of a process directory:
# Ll 126
Total 0
-R -- 1 Root 0 Jan 1 offline line
Lrwxrwxrwx 1 Root 0 Jan 1 00:09 cwd->/proc
-R -------- 1 Root 0 Jan 1 00:09 environ
Lrwxrwxrwx 1 Root 0 Jan 1 00:09 Exe->/bin/bash
Dr-x ------ 2 root Root 0 Jan 1 00:00 FD
-R -- 1 Root 0 Jan 1 00:09 maps
-RW ------- 1 Root 0 Jan 1 00:09 mem
-R -- 1 Root 0 Jan 1 00:00 mounts
-RW-r -- 1 Root 0 Jan 1 00:09 oom_adj
-R -- 1 Root 0 Jan 1 00:09 oom_score
Lrwxrwxrwx 1 Root 0 Jan 1 00:09 root->/
-R -- 1 Root 0 Jan 1 00:09 smaps
-R -- 1 Root 0 Jan 1 00:08 stat
-R -- 1 Root 0 Jan 1 00:09 statm
-R -- 1 Root 0 Jan 1 00:08 status
Dr-XR-x 3 Root 0 Jan 1 00:09 task

See the first line output above.

-R -- 1 Root 0 Jan 1 offline line

"Cmdline", which contains the entire command line used to generate the process. The contents of this file are the command line parameters, including all the parameters passed to start the process. All information contained in this file is the command and each startup parameter, without any format and any spaces.

Lrwxrwxrwx 1 Root 0 Jan 1 00:09 cwd->/proc

"CWD", as we can see above, is a symbolic link that points to the current working directory of the process.

-R -------- 1 Root 0 Jan 1 00:09 environ

"Environ" includes all environment variables defined for this process in Variabl = value. Like "cmdline", the command and parameter information contained in the file does not have any format or space.

Lrwxrwxrwx 1 Root 0 Jan 1 00:09 Exe->/bin/VER

"EXE", which is a symbolic link pointing to the executable file that starts the current process.

Dr-x ------ 2 root Root 0 Jan 1 00:00 FD

"FD", this directory contains the file descriptors opened by the specified process. If a process opens too many file descriptors, opening the file will fail, you can check this directory to find the cause of file opening failure.

-R -- 1 Root 0 Jan 1 00:09 maps

"Maps", when you type the content of the named pipeline, you can see that the address space of the process is mapped to a file. This part is from left to right: the address space related to the ing, the permissions related to the ing, And the offset from the start of the file (that is, the place where the ing starts, the device where the ing file is located, the inode Number of the file, and the file name itself.

"Root", this is a symbolic link pointing to the/proc directory of the process.

-R -- 1 Root 0 Jan 1 00:08 status

"Status", this file provides you with information about the process name, its current status, sleep or waking, its PID, uid, ppid, and a large amount of other basic information. This information can be seen in a simpler and structured syntax by using tools such as "Ps" and "TOP ".

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.