I’ve been using Linux for years, but I’ve never really known was
/proc was or why certain commands used it. I’m not sure why I’ve never looked it up in the past, but I recently did and I thought I’d share.
/proc isn’t a “real” directory, in the sense that it doesn’t exist on disk. It’s not an in memory file system either. It’s a virtual file system that exposes information from the Linux kernel.
/proc uses the procfs file system driver and is mounted to
/proc at boot time. A lot of system utilities are simply wrappers around reading files from
For example, run the following command on your Linux machine (it may look familiar):
The above command should spit out all sorts of information about your CPU. Very useful.
/proc contains all sorts of info, so I recommend looking around.
/proc/meminfo contains more info about the kernel’s memory usage than you even knew existed.
/proc/cmdline shows the options that Grub used to boot the kernel.
I find the process specific information very useful on a day-to-day basis. Process information is available under
/proc/<pid>/limits will show you the ulimits of that process as they are right now.
/proc/<pid>/oom_adj is a writable file that can adjust priorities for the out-of-memory killer, to prevent your process from being killed.
/proc/<pid>/status is the human readable status of that process.
Writing to /proc
You can also write to some proc files to change configuration options in the Linux kernel. For example, you can manipulate swappiness via
Next time you see a command that redirects output to
/proc, you’ll know it’s changing a kernel configuration option.
/proc represents the current kernel configuration, and changes will not persist through a reboot.
Useful files in /proc
There are many useful files in
/proc, so I recommend just looking around. However, the following are among the more useful.
Kernel command line arguments
CPU information such as make, model, cores, etc
List of devices (block/character devices)
List of supported filesystem drivers
Information about memory usage, both physical and swap
Kernel modules that are currently loaded
List of mounted filesystems, mount points, and mount arguments
Swap space devices and utilization
Lots of kernel parameters, most of which are writable to allow changes to kernel parameters without rebooting/recompiling
A great source of information is the Linux Documentation Project, see http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html