Chapter 2.
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 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 about 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.
2.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 constantly changing.
Virtual files such as
interrupts
,
/proc/meminfo
,
/proc/mounts
, and
/proc/partitions
pro
vide an up to the moment glimpse of the system's hardware. Others, like
/proc/filesystems
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.
2.1.1. Viewing Virtual Files
By using the
cat
,
more
, or
less
commands on files within the
/proc/
directory, you can immedi
ately access an enormous amount of information about the system. For example, if you want to see
what sort of CPU your computer has, type
cat /proc/cpuinfo
and you will see something 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
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved