From the user's or the system administrator's point of
view, the /proc filesystem looks just like
any other filesystem; you can navigate around it with the
cd command, list directory contents with the
ls command and view file contents with the
cat command. However, none of these files and
directories occupy any space on your hard disk. The kernel traps
accesses to the /proc filesystem and
generates directory and file contents on the fly. In other
words, whenever you list or directory or view file contents in
the /proc filesystem, the kernel
dynamically generates the contents you want to see.
To make this less abstract, let's see some examples.
The following example displays the list of files in the top-level
directory of the /proc filesystem:
tigger # ls /proc
1 184 25472 8 8525 kmsg
130 185 25475 82 8526 ksyms
134 186 25497 8484 8593 loadavg
136 187 25498 8485 963 locks
139 2 25499 8488 965 meminfo
143 24924 25500 8489 9654 modules
144 25441 25515 8492 968 mounts
145 25442 25549 8496 97 net
146 25445 25550 8507 99 pci
147 25446 26019 8508 cmdline scsi
148 25449 26662 8510 cpuinfo self
151 25451 26663 8511 devices stat
163 25462 270 8512 dma sys
168 25463 3 8520 filesystems uptime
172 25464 4484 8522 interrupts version
180 25465 4639 8523 ioports
182 25466 55 8524 kcore
The numbers will be different on
your system, but the general organization will be the same. All
those numbers are directories that represent one of the
processes running on your system each. For example, let's look
at the information about the process with the ID 172:
tigger # ls /proc/172
cmdline environ fd mem stat status
cwd exe maps root statm
You see a number of files that each contain information
about this process. For example, the
cmdline file shows the command line with
which this process was started. status gives
information about the internal state of the process and
cwd links to the current working directory
of this process.
Probably you'll find the hardware information even
more interesting than the process information. All the
information that the kernel has gathered about your
hardware is collected in the /proc
filesystem, even though it can be difficult to find the
information you are looking for.