proc as a kernel data structure interface, user space and 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 accessing system kernel data in a file system manner. Users and Applications
can be done by proc The system information is obtained and some parameters of the kernel can be changed.
proc The file system can be used to gather useful information about the system and the running kernel.
Access to this file system is the same as for general files.
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 eachCPUthe 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
Cat/proc/version|cut-f1-d ' ('
5.the number of context conversions performed by the kernel
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