Chapter 3.
The proc File System
The Linux kernel has two primary functions: to control access to physical devices on the computer and
to schedule when and how processes interact with these devices. The /proc/ directory — also called
the proc file system — contains a hierarchy of special files which represent the current state of the
kernel — allowing applications and users to peer into the kernel's view of the system.
Within the /proc/ directory, one can find a wealth of information detailing the system hardware and
any processes currently running. In addition, some of the files within the /proc/ directory tree can be
manipulated by users and applications to communicate configuration changes to the kernel.
3.1. A Virtual File System
Under Linux, all data are stored as files. Most users are familiar with the two primary types of files:
text and binary. But the /proc/ directory contains another type of file called a virtual file. It is for this
reason that /proc/ is often referred to as a virtual file system.
These virtual files have unique qualities. Most of them are listed as zero bytes in size and yet when
one is viewed, it can contain a large amount of information. In addition, most of the time and date
settings on virtual files reflect the current time and date, indicative of the fact they are constantly
updated.
Virtual files such as /proc/interrupts, /proc/meminfo, /proc/mounts, and /proc/
partitions provide an up-to-the-moment glimpse of the system's hardware. Others, like the /
proc/filesystems file and the /proc/sys/ directory provide system configuration information and
interfaces.
For organizational purposes, files containing information on a similar topic are grouped into virtual
directories and sub-directories. For instance, /proc/ide/ contains information for all physical IDE
devices. Likewise, process directories contain information about each running process on the system.
3.1.1. Viewing Virtual Files
By using the cat, more, or less commands on files within the /proc/ directory, users can
immediately access enormous amounts of information about the system. For example, to display the
type of CPU a computer has, type cat /proc/cpuinfo to receive output similar to the following:
processor : 0
vendor_id : AuthenticAMD
cpu family : 5
model
: 9
model name : AMD-K6(tm) 3D+
Processor stepping : 1 cpu
MHz
: 400.919
cache size : 256 KB
fdiv_bug : no
hlt_bug
: no
f00f_bug : no
coma_bug : no
fpu
: yes
fpu_exception : yes
cpuid level : 1
wp
: yes
flags
: fpu vme de pse tsc msr mce cx8 pge mmx syscall 3dnow k6_mtrr
bogomips : 799.53
15
Need help?
Do you have a question about the ENTERPRISE LINUX 5 - DEPLOYMENT and is the answer not in the manual?
Questions and answers