/proc File System

Source: Internet
Author: User

Linux provides a special file system PROCFS, usually presented in the form of/proc directories. This directory contains a number of special files for higher-level access to driver and kernel information. As long as the application has the correct access holographic, you can obtain information or set parameters by reading and writing these files.

For example,/proc/cpuinfo gives detailed information about the CPU:

My Notebook is a 4-core machine.

Processor:3VENDOR_ID:GENUINEINTELCPU Family:6Model: -model Name:intel (R) Core (TM) i7-3520m CPU @2. 90GHzstepping:9microcode:0x1cCPU MHz:1227.289Cache Size:4096kbphysical ID:0Siblings:4Core ID:1CPU Cores:2Apicid:3Initial apicid:3Fpu:yesfpu_exception:yescpuid Level: -wp:yesflags:fpu vme de PSE TSC MSR PAE MCE cx8 APIC Sep MTRR PGE MCA cmov Pat PSE36 Clflush DTS ACPI MMX FXSR SSE SSE2 SS HT
TM PBE syscall NX rdtscp lm constant_tsc Arch_perfmon pebs BTS rep_good nopl xtopology NONSTOP_TSC aperfmperf
EAGERFPU PNI pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt
Tsc_deadline_timer AES Xsave AVX f16c Rdrand lahf_lm ida Arat EPB PLN pts dtherm Tpr_shadow vnmi flexpriority ept
Vpid fsgsbase smep erms xsaveoptbugs:bogomips:5787.00Clflush Size: -cache_alignment: -Address sizes: $Bits physical, -BitsVirtualPower Management:

Similarly, cat/proc/meminfo and cat/proc/version are respectively abolished as memory usage and kernel version information.

[Email protected]-proc]# cat/proc/ 4.4. 6-
5.3. 1 20151207 5.3. 1-2) (GCC) #1:2016

Each time the reader writes the contents of the file, the information they provide will be updated in a timely manner.

---------------------

You can get more information through the heart and function, in subdirectories of the/proc directory,

For example, you can obtain usage statistics for network sockets through the/proc/net/sockstat file:

[Email protected]-proc]# cat/proc/net/ 8180  10 7 1  0  000

In addition, some entries in the/proc can be read and modified.

For example, the total number of files that can be opened by all running programs in the system is a parameter of the Linux kernel, and its current value can be obtained by reading the/proc/sys/fs/file-max file.

[Email protected]-proc]# cat/proc/sys/fs/file- 370753

You can modify this parameter for Linux by modifying this file.

======================

A number-named subdirectory in the/proc directory is used to provide information about a running program.

Using Pe-ef | grep Firefox View the process number of Firefox

You can view the execution of a process in the/proc/firefox process number file

[[Email protected] -- theproc]# ls-l/proc/6669 Total0Dr-xr-xr-x.2Lizhen Lizhen0June the  -: -attr-rw-r--r--.1Lizhen Lizhen0June the  -: -Autogroup-R--------.1Lizhen Lizhen0June the  -: -AUXV-r--r--r--.1Lizhen Lizhen0June -  +: -Cgroup--w-------.1Lizhen Lizhen0June the  -: -Clear_refs-r--r--r--.1Lizhen Lizhen0June -  +: -CmdLine-rw-r--r--.1Lizhen Lizhen0June -  +: -Comm-rw-r--r--.1Lizhen Lizhen0June the  -: -Coredump_filter-r--r--r--.1Lizhen Lizhen0June the  -: -cpusetlrwxrwxrwx. 1Lizhen Lizhen0June the  -: -/home/, CWDLizhen-R--------.1Lizhen Lizhen0June the  -: -environlrwxrwxrwx. 1Lizhen Lizhen0June -  +: -EXE-/usr/lib64/firefox/firefoxdr-X------.2Lizhen Lizhen0June -  +: -fddr-X------.2Lizhen Lizhen0June the  -: -Fdinfo-rw-r--r--.1Lizhen Lizhen0June the  -: -Gid_map-R--------.1Lizhen Lizhen0June the  -: -io-r--r--r--.1Lizhen Lizhen0June the  -: -Latency-r--r--r--.1Lizhen Lizhen0June the  -: -Limits-rw-r--r--.1Lizhen Lizhen0June -  +: -loginuiddr-X------.2Lizhen Lizhen0June the  -: -Map_files-r--r--r--.1Lizhen Lizhen0June -  +: -Maps-RW-------.1Lizhen Lizhen0June the  -: -Mem-r--r--r--.1Lizhen Lizhen0June -  +: -Mountinfo-r--r--r--.1Lizhen Lizhen0June the  -: -Mounts-R--------.1Lizhen Lizhen0June the  -: -MOUNTSTATSDR-xr-xr-x.6Lizhen Lizhen0June the  -: -NETDR-x--x--x.2Lizhen Lizhen0June -  +: -NS-r--r--r--.1Lizhen Lizhen0June the  -: -Numa_maps-rw-r--r--.1Lizhen Lizhen0June the  -: -Oom_adj-r--r--r--.1Lizhen Lizhen0June the  -: -Oom_score-rw-r--r--.1Lizhen Lizhen0June the  -: -Oom_score_adj-R--------.1Lizhen Lizhen0June the  -: -Pagemap-R--------.1Lizhen Lizhen0June the  -: -Personality-rw-r--r--.1Lizhen Lizhen0June the  -: -projid_maplrwxrwxrwx. 1Lizhen Lizhen0June the  -: -Root-/-rw-r--r--.1Lizhen Lizhen0June the  -: -sched-r--r--r--.1Lizhen Lizhen0June the  -: -Schedstat-r--r--r--.1Lizhen Lizhen0June -  +: -SessionID-rw-r--r--.1Lizhen Lizhen0June the  -: -setgroups-r--r--r--.1Lizhen Lizhen0June the  -: -Smaps-R--------.1Lizhen Lizhen0June the  -: -Stack-r--r--r--.1Lizhen Lizhen0June -  +: -Stat-r--r--r--.1Lizhen Lizhen0June the  -: -STATM-r--r--r--.1Lizhen Lizhen0June -  +: -Status-R--------.1Lizhen Lizhen0June the  -: -Syscalldr-xr-xr-x. -Lizhen Lizhen0June -  +: -Task-r--r--r--.1Lizhen Lizhen0June the  -: -Timers-rw-r--r--.1Lizhen Lizhen0June the  -: -Uid_map-r--r--r--.1Lizhen Lizhen0June the  -: -Wchan[[email protected]- -- theproc]#

/proc File System

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.