Linux /proc Directory and Useful Outputs Explained

The linux /proc filesystem was developed to provide information about the processes in a system. But many elements of the filesystem are used by the kernel to get information and also to enable dynamic runtime configuration. The /proc filesystem contains directories to organize the information and virtual files. A virtual file acts like a mediator - conveying information from the kernel to the user and sending information from the user to the kernel. In this article,you will get to know how to configure the filesystem for input and output.

The /proc filesystem can be used to find information about system related tasks such as:

1. Querying statistical information
2. Hardware information
3. Changing runtime parameters
4. Viewing and changing network and host parameters
5. Memory related information

One important thing to remember about the content of the files in the /proc directory is that its sub-directories structure is entirely dependent on information concerning a particular system and also on kernel version. In other words, do not expect to see the exact same information in the same /proc file on two different machines. /proc is in RAM, thus you cannot delete it.

/proc filesystem listing

Given below is a command for listing of the /proc elements. The output displays the root level of the /proc filesystem. There is a series of numbered files on the left, each of which represent a directory that corresponds to a process in the system.

The first process to start in Linux is the init process, it has a process-id of 1.

# ls /proc
1 2040 2347 2874 474 fb mdstat sys

104 2061 2356 2930 9 filesystems meminfo sysrq-trigger

113 2073 2375 2933 acpi fs misc sysvipc

1375 21 2409 2934 buddyinfo ide modules tty

1395 2189 2445 2935 bus interrupts mounts uptime

1706 2201 2514 2938 cmdline iomem mtrr version

179 2211 2515 2947 cpuinfo ioports net vmstat

180 2223 2607 3 crypto irq partitions

181 2278 2608 3004 devices kallsyms pci

182 2291 2609 3008 diskstats kcore self

2 2301 263 3056 dma kmsg slabinfo

2015 2311 2805 394 driver loadavg stat

2019 2337 2821 4 execdomains locks swaps

Next, if you want to see the command-line entry for init, simply cat the cmdline file.

# cat /proc/1/cmdline

init [5]

Other files that are somewhat important include:

a. cpuinfo - which identifies the type of processor and its speed
b. pci - which shows the devices found on the PCI buses
c. modules - which identifies the modules that are currently loaded into the kernel.

Version of the Linux kernel, gcc, name of the Linux distro installed:

#cat /proc/version

Contains information about uptime of the system:

#cat/proc/uptime

Measures the swap space and its utilization:

#cat /proc/swap

Keeps track of a variety of different statistics about the system since it was last restarted:

#cat /proc/stat

Display all PCI device on your system:

#cat /proc/pci

Information on the various partitions currently available on the system:

#cat /proc/partitions

This file provides list of all mount points in use by the system:

#cat /proc/mounts

Displays a list of all modules that have been loaded by the system:

#cat /proc/modules

Current utilization of primary memory on the system:

#cat /proc/meminfo

Information about the processors:

#cat /proc/cpuinfo

File systems supported by the kernel:

#cat /proc/filesystems

Number of interrupts per IRQ on architecture:

#cat /proc/interrupts

Bobbin Zachariah 7:58 pm

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.