What is Proc Linux

The / proc filesystem

The directory is not a real file system, but an interface to the kernel. The files in this directory do not use any space on the hard disk, but they can still be read and in some cases also written to.

This directory gets its name from the fact that it has a subdirectory for every running process that provides information about this process. The name of the subdirectory is the process ID (PID) of the respective process. It contains the following files, among others:

  • The command line with which the process was started, with all parameters used.

  • (current working directory) A symbolic link to the directory that was the current working directory when the process was called.

  • The complete environment of the process (variables, functions, etc.) if it has an environment.

  • A symbolic link to the called program that makes up the process.

  • A symbolic link to the directory that represents the root directory for the process.
There is also further information on the resources used (storage, libraries) and a subdirectory fdcontaining the file descriptors of all files used by the process.

This information is used, for example, by the programs that output process information.

But what is much more important for us in connection with hardware is the ability to access certain information in the / proc directory that is hardware-relevant.

The hardware parameters in the / proc directory

As already emerged from the hardware parameters page, in order to address certain hardware, we need settings that must be made on the hardware side as well as known to the operating system. In order to determine which of these parameters Linux assigns to which hardware, the directory offers us several files that contain this information. As a reminder, these are not real files, but interfaces to the kernel. So there is no static information but the current information of the kernel, which parameters are used by which hardware. These files are excellent diagnostic tools, and they are usually useful when troubleshooting. Their content is with programs like cat or less visible.

The following files in the directory play a role for the hardware parameters:

Displays a list of the currently required IRQ channels, along with information on who is using these IRQs (to whom they are assigned) and how often the respective IRQs have already been triggered.
Displays a list of the IO addresses that are currently in use and the information to whom they are assigned. The addresses are specified as an address range that shows how broad the access to such an address is. The specification 0170-0177: ide1 shows, for example, that the second IDE interface with a width of 8 bits (170-177 = 8 bits) is being accessed. (This is the access width to the controller, not to the data!).
Here we find the details of the DMA channels used together with information on who is using them.
The memory areas of the various memory types are displayed here. In addition to the normal main memory (system RAM), this also includes the areas of the screen memory of the graphics card (video RAM) and the respective ROMs of the motherboard (system ROM) and the expansion cards (e.g. video ROM), as well as the memory of the PCI system, in which the bus information is stored. This information is given as address ranges (start address - end address).

Other hardware information in the / proc directory

In addition to the hardware parameters used, the directory also contains some other interesting information about the hardware used, which is very useful for diagnostic purposes. These include the files:
All information that the kernel has about the processor (s) used can be found here. This includes processor type and model, clock rate, cache size and lots of information about possible processor bugs.
A list of the block and character devices that the kernel currently supports. In addition to the respective specification of the device name, we also find the major number used here.
A list of all disk partitions known to the system, including major and minor numbers. Depending on whether the kernel supports the devfs File system supported or not, the information is in the form major minor #blocks name 3 0 16617888 hda 3 1 1028128 hda1 (old format) or major minor #blocks name 3 0 19925880 ide / host0 / bus0 / target0 / lun0 / disc 3 1 4200966 ide / host0 / bus0 / target0 / lun0 / part1 (new representation when using devfs) is displayed.
Information that the scan of the PCI bus revealed. Here you can find information about all PCI devices connected to the system. The AGP bus (which is actually just an extra PCI bus with only one slot) is also given here along with all the cards found.

Kernel and software information in the / proc directory

In addition to the hardware information, the directory also contains some details about the kernel itself and its capabilities, as well as information about the current system status. These include:
The command line used to start the kernel itself. The corresponding kernel parameters that were given when booting can also be found here. The file name of the current kernel is also given.
A list of all file system types that the kernel currently knows.
Information about the current memory usage.
A list of the currently loaded kernel modules.
A list of all mounted file systems. The file systems that start with the option can also be found here -n have been mounted and are therefore neither in the file nor can they be displayed using the df command.
The current kernel version.

Other important subdirectories in / proc

In addition to the files discussed, there are also a number of subdirectories in the directory that contain further information about connected devices and kernel features. These include in particular:
Information about the found bus systems (PCI, USB, ...)
Information about IDE devices and interfaces.
Information about SCSI devices and interfaces.
Information about network-relevant settings. Here we find, for example, the routing tables and the ARP information that the kernel currently has.

Active change options under / proc / sys

So far we've only used the directory to get information about certain kernel properties. But we can also change the settings of certain kernel capabilities in the directory. We do this by writing the desired values ​​to the files instead of just reading them. As a rule, however, these are only files that contain individual values, usually a 1 or 0, which represent a "true" or "false".

A simple example of this capability is setting whether or not our kernel is able to act as a router. A router is a computer that forwards individual network packets from one network interface to another. We can find out whether this capability is activated or not by looking at the contents of the file. So we write

cat / proc / sys / net / ipv4 / ip_forward The output we get is 0, which means "no". Now we want to make our kernel routable. To do this, we write a 1 into this file. To do this, we do not use an editor, but simply the command echo This command outputs something to the standard output, which we then redirect to the desired file: echo 1> / proc / sys / net / ipv4 / ip_forward And the kernel is already able to route.

This example makes it clear that the directory is also suitable for changing the kernel properties. By and large, all settings under can be varied in this way.




[Back to LPIC 101 page] [Back to home page] [Back to LPI page] [Contact] [Imprint]

This and the pages below were created by F. Kalhammer

© 2002 by F.Kalhammer -
Permission is granted to copy, distribute and / or modify this document under the terms of the GNU Free Documentation License ..