Proc File system for Linux

Source: Internet
Author: User

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




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.