Everything About /proc File System on Linux

Linux TLDR
Last Updated:
Reading time: 3 minutes

Proc file system (short for β€œprocfs”, referring to β€œ/proc” dir) is a virtual file system (not a real file system) that is mounted on system boot to store information related to running processes.

The proc file system stores useful information about the running process and also lets the kernel space and user space communicate with each other.

When you list the content of the β€œ/proc” directory using the ls command, you will get a bunch of directories, and their names will be in integer format, where β€œinteger” refers to a process identifier.

$ ls -l /proc


Listing the content of the "/proc" directory

Within the same directory, you will find the β€œmeminfoβ€œ, β€œcpuinfoβ€œ, β€œdevicesβ€œ, β€œfilesystemsβ€œ, etc. files that contain system related information.

Execute the following command to get the complete list of system information files:

$ ls -p /proc/ | grep -v /


Listing the system information files from the "/proc" directory

Here is a list of the known system information files with their descriptions in the β€œ/proc” directory.

System Information FileDescription
/proc/cryptoList of available cryptographic modules.
/proc/cmdlineKernel command line information.
/proc/consolesCurrent console information (including tty).
/proc/devicesInformation related to device drivers currently configured for the running kernel.
/proc/diskstatsInformation (including device numbers) for each of the logical disk devices.
/proc/dmaDMA channels information.
/proc/fbFrame buffer device information.
/proc/filesystemsList of file systems supported by the kernel.
/proc/iomemInformation related to the current system memory map for devices.
/proc/ioportsI/O ports related information.
/proc/kmsgHolding messages output by the kernel.
/proc/loadavgAverage system load.
/proc/locksList of files currently locked by the kernel.
/proc/meminfoInformation about system memory.
/proc/miscMiscellaneous driver related information.
/proc/modulesInformation on the kernel modules that are currently loaded
/proc/mountsList of mounted devices on the system.
/proc/partitionsInformation about all available partitions on the system.
/proc/pciPCI device.
/proc/statDisplay file and filesystem information.
/proc/swapDisplay the swap related information.
/proc/uptimeUptime information
/proc/versionKernel, GCC, and distribution related information

Read the content of any of the above mentioned files (ex: β€œmeminfoβ€œ) by using the cat command.

$ cat /proc/meminfo


Memory (meminfo) file

As I’ve told you earlier, each directory inside β€œ/proc” is in integer format, where β€œinteger” refers to a process identifier.

To find any process related information, first find its process identifier (or PID) using the ps command.

$ ps aux | grep gedit

Replace β€œgedit” with your process name.

Checking the PID

Use the PID from the above output to list the content of all files and links related to the referenced process.

$ ls /proc/32710/


Listing the content of processes under the "/proc" directory

The following is a list of each directory along with its description that resides in the process directory.

/proc/PID/cmdlineInformation about process command line arguments.
/proc/PID/cpuInformation about the current and last CPU instance in which the process was executed.
/proc/PID/cwdLink to the process’s current working directory.
/proc/PID/environInformation about environmental variables inherited by the process.
/proc/PID/exeLink to the executable of the referenced process.
/proc/PID/fdList of all file descriptors under the process.
/proc/PID/mapsInformation about memory maps to executable and library files.
/proc/PID/memInformation about memory held by the referenced process.
/proc/PID/rootLink to the referenced process’s root directory.
/proc/PID/statProcess status.
/proc/PID/statmProcess memory status information.
/proc/PID/statusProcess status in human readable form.

To get the list of file descriptors under the running process, issue the following command:

$ ls -l /proc/32710/fd


File descriptors under the current process

To output the current working directory of the running process, issue the following command:

$ ls -l /proc/32710/cwd


Current working directory of the running process

This way, you can list and check various information related to the referenced process.

Final Tips!

The proc file system is a crucial part of Linux computing, and using it, you can check a bunch of information about specific processes or system information.

If you have any questions or queries related to this topic, then feel free to ask them in the comment section.

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.

1 thought on β€œEverything About /proc File System on Linux”