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 as a mediator - conveying information from the kernel to the user and sending information from the user to the kernel.
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 on a particular system and also about kernel information. 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.
Below output displays the root level contents of the /proc filesystem. There is a series of numbered files (left side of output), each of which represents 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 
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.
What's Inside /proc directory
Version of the Linux kernel, gcc, name of the Linux distro installed
# cat /proc/version
Contains information about uptime of the system:
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
The number of interrupts per IRQ on architecture:
# cat /proc/interrupts
Thanks for reading and please leave your thoughts on the below comment section.