The proc filesystem

The Linux kernel supports a special filesystem type of proc. This can be monitored to any directory like a normal filesystem, however there is normally only one instance of this type of filesystem mounted on the root filesystem to the /proc directory. There are many programs, which expect this filesystem type to be mounted here.

If you look at the /etc/fstab file, you will see that there is a filesystem mounted to /proc of type "proc". The device file used maybe any string, as this is unused is proc's case.

The proc filesystem provides an abstracted interface to kernel settings in kernel memory, without having to access kernel memory directly by using the device file /dev/kmem.

If you do an "ls -l /proc", you will see a number of files and directories. These are not real disk files, but rather fake files generated automatically by the kernel that contain the values of different system variables and kernel settings.

Some of these files can be written to as if they were regular text files, so that the system administrator can change the behaviour of the kernel in real time other files can only be read from.

There are four main kinds of information displayed as virtual files in the proc filesystem:

  1. The process table

  2. Kernel tuneable parameters

  3. Detected hardware devices

  4. Other tables and settings including the mount table, memory information and currently supported filesystems.

Exercise:

  1. Look at the proc(5) man page ("man 5 proc")

  2. Examine the files and directories under /proc by using the ls and cat commands.

[Note] Note

Note that you can also view and modify system tuneable parameters by running the sysctl(8) command, which using the sysctl(2) system call in the kernel. (See the section called “Performance Tuning”)