Appendix E. The proc File System
/proc/directory (also called the
procfile 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.
/proc/directory contains a wealth of information detailing system hardware and any running processes. In addition, some of the files within
/proc/can be manipulated by users and applications to communicate configuration changes to the kernel.
/proc/pci/directories obsolete. The
/proc/ide/file system is now superseded by files in
sysfs; to retrieve information on PCI devices, use
lspciinstead. For more information on
lspci, see their respective
E.1. A Virtual File System
/proc/directory contains another type of file called a virtual file. As such,
/proc/is often referred to as a virtual file system.
/proc/partitionsprovide an up-to-the-moment glimpse of the system's hardware. Others, like the
/proc/filesystemsfile and the
/proc/sys/directory provide system configuration information and interfaces.
E.1.1. Viewing Virtual Files
/proc/files operate similarly to text files, storing useful system and hardware data in human-readable text format. As such, you can use
lessto view them. For example, to display information about the system's CPU, run
cat /proc/cpuinfo. This will return 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
/proc/contain information that is not human-readable. To retrieve information from such files, use tools such as
/proc/directory are readable only by the root user.
E.1.2. Changing Virtual Files
/proc/directory are read-only. However, some can be used to adjust settings in the kernel. This is especially true for files in the
echo value > /proc/file
echo www.example.com > /proc/sys/kernel/hostname
cat /proc/sys/net/ipv4/ip_forwardreturns either a
0(off or false) or a
1(on or true). A
0indicates that the kernel is not forwarding network packets. To turn packet forwarding on, run
echo 1 > /proc/sys/net/ipv4/ip_forward.
/sbin/sysctl. For more information on this command, see Section E.4, “Using the sysctl Command”
/proc/sys/subdirectory, see Section E.3.9, “/proc/sys/”.