proc , the user space and the kernel space can communicate through this interface,
Unlike normal files. the contents of these virtual files are created dynamically.
proc file system is a pseudo file system, it only exists in memory, Without occupying external memory space.
it provides an interface for access to system kernel data in the form of a file system. Users and Applications
to pass proc get information about the system. And can change some of the kernel's parameters.
proc The file system can be used to collect useful information about the system and the kernel in execution.
Access to this file system is the same as for general documentation.
Cases:
1. Statistics CPU Number:
Cat/proc/cpuinfo | grep ' physical ID ' |uniq-c|wc–l
2.CPU model
Cat/proc/cpuinfo|grepname|cut-f2-d:|uniq
3.calculate each of theCPUthe number of cores
Cat/proc/cpuinfo | grep ' physical id ' |awk-f ': ' {count[$2]++;} End{sum=0;for (A in count) {cc++;sum+=count[a]}printsum/cc;} '
4.Kernel version number
Cat/proc/version|cut-f1-d ' ('
5.the number of context conversions that the kernel is running
Cat/proc/stat|grep Ctxt|awk ' {print $} '
6. Number of processes created by the system
Cat/proc/stat|grep Processes|awk ' {print $} '
7. The amount of memory currently available
Cat/proc/meminfo|grep Memfree
Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.
Proc File system for Linux