One of the more interesting aspects of certain flavors of UN*X (Linux among
them) is the
/proc filesystem. This "virtual" filesystem
has several key features which are interesting, useful and helpful. It can also
be dangerous and disastrous. This column will approach the
filesystem in three areas:
/proccan be used for (or sometimes not to be used for)
/procas of the 2.2 Kernel on the i686 architecture
/proc filesystem is a direct reflection of the system kept in memory and represented in a hierarchal manner. The effort of the
/proc filesystem is to provide an easy way to view kernel and information about currently running processes. As a result, some commands (ps for example) read
/proc directly to get information about the state of the system. The premise behind
/proc is to provide such information in a readable manner instead of having to invoke difficult to understand system calls.
/proccan do for an Administrator
/proc fs can be used for system related tasks such as:
There are some things to take note of, most of those tasks can be done with tools that either peruse
/proc or query the kernel directly.
Different kernels can allow for different changes and information that is presented within
/proc. Some, all, or totally different layouts and capabilities may exist depending on your machine's kernel implementation.
Since there is no one place that documents exactly what you can and cannot do with
/proc (again because of distro's) there is no fool-proofing it other than only root may actually descend
/proc and monkey with the files therein. I have found the easiest approach to be a sort of hacker method - backup your kernel and apply common sense when making alterations within the
A prime example of tuning applications via
/proc can be found at the The C10k problem document at Dan Kegel's Web Hostel.
Following is a table with brief descriptions of files and directories in
/proc with the 2.2 kernel on a Linux i686 architecture.
|Average of system load for the last 1, 5 and 15 minutes|
|Time in seconds since boot-up and total time used by processes|
|The number of total, used and free bytes of memory and swap area(s)|
|Kernel messages that have yet to be read in by the kernel|
|Current rev of the kernel and/or distribution (read from |
|Recognized processor parameters|
|Current occupation of |
|Information about processes currently accessing |
|Descriptions about the network layer(s)|
|Contains files with information on individual scsi devices|
|Monitoring provisions for |
|A core dump for the kernel (memory snapshot)|
|Information regarding single loaded modules|
|General Linux Statistics|
|Information about kernel registered devices on the system|
|Interrupt assignment information|
|Existing filesystem implementations|
|Symbols exported by the kernel|
|Occupied DMA channels|
|Currently occupied IO ports|
|Individual information about CPU's if SMP is enabled|
|Command line parameters passed to the kernel at boot time|
|Important kernel and network information|
|Currently mounted filesystems|
|Multiple device driver information (if enabled)|
|Enhanced real time clock (if enabled)|
|Currently locked files|
The number directories are running process information by PID.
Again, keep in mind that the capabilities of /proc and it's contents do vary version to version, otherwise, happy exploring.
Below is a short list of sites with in depth information (LDP aside of course) about /proc contributed by readers: