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
Within the same directory, you will find the “
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 /
Here is a list of the known system information files with their descriptions in the “
|System Information File
|List of available cryptographic modules.
|Kernel command line information.
|Current console information (including tty).
|Information related to device drivers currently configured for the running kernel.
|Information (including device numbers) for each of the logical disk devices.
|DMA channels information.
|Frame buffer device information.
|List of file systems supported by the kernel.
|Information related to the current system memory map for devices.
|I/O ports related information.
|Holding messages output by the kernel.
|Average system load.
|List of files currently locked by the kernel.
|Information about system memory.
|Miscellaneous driver related information.
|Information on the kernel modules that are currently loaded
|List of mounted devices on the system.
|Information about all available partitions on the system.
|Display file and filesystem information.
|Display the swap related information.
|Kernel, 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
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
gedit” with your process name.
Use the PID from the above output to list the content of all files and links related to the referenced process.
$ ls /proc/32710/
The following is a list of each directory along with its description that resides in the process directory.
|Information about process command line arguments.
|Information about the current and last CPU instance in which the process was executed.
|Link to the process’s current working directory.
|Information about environmental variables inherited by the process.
|Link to the executable of the referenced process.
|List of all file descriptors under the process.
|Information about memory maps to executable and library files.
|Information about memory held by the referenced process.
|Link to the referenced process’s root directory.
|Process memory status information.
|Process 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
To output the current working directory of the running process, issue the following command:
$ ls -l /proc/32710/cwd
This way, you can list and check various information related to the referenced process.
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.