Linux System proc Directory process information detailed __linux

Source: Internet
Author: User
The Proc file system is a real-time, resident memory file system that tracks how the process works on your machine and the state of your system. The/proc file system is a resident virtual memory and maintains the dynamic data of the operating system. Most of the/proc file system Information is updated in real time to match the state of the current operating system. The content of the/proc file system can be read by anyone with appropriate permissions. However, the specific part of the/proc file system can only be read by the owner and root user of the process. The/proc file system's contents are available from the specific/proc directory and are displayed for many purposes.
The following is an example of a proc file system, you can see that the proc file system has a lot of numbers, other information relatively easy to understand, not introduced here, this article mainly in-depth analysis of the proc directory of digital information.
#cd proc #ls
1 4 9 diskstats iomem Meminfo self uptime
5 Driver ioports Misc Slabinfo Version
114 6 Buddyinfo execdomains IRQ Mounts stat Vmstat
126 7 bus filesystems Kcore MTD swaps zoneinfo
128 8 CmdLine FS kmsg NET Sys
2 Cpuinfo IDE LOADAVG partitions SYSVIPC
3 Devices interrupts locks PCI TTY
The digital directories that you see above represent processes that are running on the machine when we snapshot the/proc file system. Let's take a look at the contents of a process directory:
# LL 126
Total 0
-r--r--r--1 root 0, 1 00:08 cmdline
lrwxrwxrwx 1 Root 0 1 00:09 cwd->/proc
-r--------1 root 0 1 00:09 environ
lrwxrwxrwx 1 root 0, 1 00:09 exe->/bin/bash
Dr-x------2 Root 0 1 00:00 FD
-r--r--r--1 root 0, 1 00:09 maps
-RW-------1 Root 0 1 00:09 mem
-r--r--r--1 root 0, 1 00:00 mounts
-rw-r--r--1 root 0, 1 00:09 oom_adj
-r--r--r--1 root 0, 1 00:09 oom_score
lrwxrwxrwx 1 root 0, 1 00:09 root->/
-r--r--r--1 root 0, 1 00:09 smaps
-r--r--r--1 root 0, 1 00:08 stat
-r--r--r--1 root 0, 1 00:09 statm
-r--r--r--1 root 0, 1 00:08 status
Dr-xr-xr-x 3 Root 0, 1 00:09 task

Look at the first line of output above.

-r--r--r--1 root 0, 1 00:08 cmdline

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

lrwxrwxrwx 1 Root 0 1 00:09 cwd->/proc

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

-r--------1 root 0 1 00:09 environ

"Environ" includes all the environment variables defined for this process in Variabl=value. As with "CmdLine", the information contained in the commands and individual parameters in the file has no formatting or spaces.

lrwxrwxrwx 1 root 0, 1 00:09 exe->/bin/ver

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

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

"FD", which includes a file descriptor opened by the specified process, if a process opens a file descriptor that is too large, can cause open files to fail, and check this directory to find out why the open file failed.

-r--r--r--1 root 0, 1 00:09 maps

"Maps", when you hit the contents of this named pipe, you can see the address space part of the process that is currently mapped to a file. This section, left to right, is: The address space associated with this mapping, the permissions associated with this mapping, the offset from the beginning of the file (that is, where the mapping started), the device where the mapping file is located, the inode number of the file, and finally the filename itself.

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

-r--r--r--1 root 0, 1 00:08 status

"Status", this file gives you information about the process name, its current state, sleep or wakefulness, its pid,uid,ppid and a lot 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.