"Linux Gazette...making Linux just a little more fun!"


An Overview of the Proc Filesystem

By Jay Fink


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 /proc filesystem in three areas:

  1. A brief explanation of what it is
  2. What /proc can be used for (or sometimes not to be used for)
  3. A map of /proc as of the 2.2 Kernel on the i686 architecture

What is /proc?

The /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.

What /proc can do for an Administrator

The /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 = Different Capabilities

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.

The Obligatory Warning

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 /proc fs.

A prime example of tuning applications via /proc can be found at the The C10k problem document at Dan Kegel's Web Hostel.

A Map of /proc

Following is a table with brief descriptions of files and directories in /proc with the 2.2 kernel on a Linux i686 architecture.

loadavgAverage of system load for the last 1, 5 and 15 minutes
uptimeTime in seconds since boot-up and total time used by processes
meminfoThe number of total, used and free bytes of memory and swap area(s)
kmsgKernel messages that have yet to be read in by the kernel
versionCurrent rev of the kernel and/or distribution (read from linux_banner
cpuinfoRecognized processor parameters
pciCurrent occupation of pci slots.
self/Information about processes currently accessing /proc
net/Descriptions about the network layer(s)
scsi/Contains files with information on individual scsi devices
mallocMonitoring provisions for kmalloc and kfree operations
kcoreA core dump for the kernel (memory snapshot)
modulesInformation regarding single loaded modules
statGeneral Linux Statistics
devicesInformation about kernel registered devices on the system
interruptsInterrupt assignment information
filesystemsExisting filesystem implementations
ksymsSymbols exported by the kernel
dmaOccupied DMA channels
ioportsCurrently occupied IO ports
smpIndividual information about CPU's if SMP is enabled
cmdlineCommand line parameters passed to the kernel at boot time
sys/Important kernel and network information
mtabCurrently mounted filesystems
mdMultiple device driver information (if enabled)
rcEnhanced real time clock (if enabled)
locksCurrently locked files

Numbered Directories

The number directories are running process information by PID.

Results May Vary

Again, keep in mind that the capabilities of /proc and it's contents do vary version to version, otherwise, happy exploring.

For More Information

Below is a short list of sites with in depth information (LDP aside of course) about /proc contributed by readers:


Copyright © 1999, Jay Fink
Published in Issue 46 of Linux Gazette, October 1999


[ TABLE OF CONTENTS ] [ FRONT PAGE ]  Back [ Linux Gazette FAQ ]  Next