Important Linux /proc filesystem files you need to know
As you read in my first article, Exploring the /proc filesystem, the /proc
filesystem contains a lot of files that system administrators can use to discover the hardware makeup, the configuration parameters, and the complement of processes on a running system. Not all of the files have the same value to a sysadmin. In this article, I'm covering the text files (not directories/processes) with the highest value to sysadmins. That said, please realize that my definition of value means value to me and to my discovery on inherited systems and on systems with which I have little familiarity.
The following is a list of /proc
directory common text files on Red Hat-based systems:
/proc/apm
/proc/buddyinfo
/proc/cmdline
/proc/cpuinfo
/proc/crypto
/proc/devices
/proc/dma
/proc/execdomains
/proc/fb
/proc/filesystems
/proc/interrupts
/proc/iomem
/proc/ioports
/proc/kcore*
/proc/kmsg*
/proc/loadavg
/proc/locks
/proc/mdstat
/proc/meminfo
/proc/misc
/proc/modules
/proc/mounts
/proc/mtrr
/proc/partitions
/proc/pci
/proc/slabinfo*
/proc/stat
/proc/swaps
/proc/sysrq-trigger
/proc/uptime
/proc/version
* root readable only
If you issue a long listing command (ls -l /proc
), you'll notice that all files but the kcore
(not shown) file have a zero size. However, these files are not empty. They contain valuable information.
$ ls -l /proc
-r--r--r--. 1 root root 0 Feb 25 23:13 buddyinfo
-r--r--r--. 1 root root 0 Feb 25 23:13 cgroups
-r--r--r--. 1 root root 0 Feb 25 23:13 cmdline
-r--r--r--. 1 root root 0 Feb 25 23:13 consoles
-r--r--r--. 1 root root 0 Feb 25 23:13 cpuinfo
-r--r--r--. 1 root root 0 Feb 25 23:13 crypto
-r--r--r--. 1 root root 0 Feb 25 23:13 devices
-r--r--r--. 1 root root 0 Feb 25 23:13 diskstats
-r--r--r--. 1 root root 0 Feb 25 23:13 dma
The /proc
files I find most valuable, especially for inherited system discovery, are:
- cmdline
- cpuinfo
- meminfo
- version
And the most valuable of those are cpuinfo
and meminfo
.
Again, I'm not stating that other files don't have value, but these are the ones I've found that have the most value to me. For example, the /proc/uptime
file gives you the system's uptime in seconds. For me, that's not particularly valuable. However, if I want that information, I use the uptime
command that also gives me a more readable version of /proc/loadavg
as well.
By comparison:
$ cat /proc/uptime
46901.13 46856.69
$ cat /proc/loadavg
0.00 0.01 0.03 2/111 2039
$ uptime
00:56:13 up 13:01, 2 users, load average: 0.00, 0.01, 0.03
I think you get the idea.
/proc/cmdline
This file shows the parameters passed to the kernel at the time it is started.
$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-1062.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8
The value of this information is in how the kernel was booted because any switches or special parameters will be listed here, too. And like all information under /proc
, it can be found elsewhere and usually with better formatting, but /proc
files are very handy when you can't remember the command or don't want to grep
for something.
/proc/cpuinfo
The /proc/cpuinfo
file is the first file I check when connecting to a new system. I want to know the CPU make-up of a system and this file tells me everything I need to know.
$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
stepping : 9
cpu MHz : 2303.998
cache size : 4096 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc eagerfpu pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase avx2 invpcid rdseed clflushopt md_clear flush_l1d
bogomips : 4607.99
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
This is a virtual machine and only has one vCPU. If your system contains more than one CPU, the CPU numbering begins at 0 for the first CPU.
/proc/meminfo
The /proc/meminfo
file is the second file I check on a new system. It gives me a general and a specific look at a system's memory allocation and usage.
$ cat /proc/meminfo
MemTotal: 1014824 kB
MemFree: 643608 kB
MemAvailable: 706648 kB
Buffers: 1072 kB
Cached: 185568 kB
SwapCached: 0 kB
Active: 187568 kB
Inactive: 80092 kB
Active(anon): 81332 kB
Inactive(anon): 6604 kB
Active(file): 106236 kB
Inactive(file): 73488 kB
Unevictable: 0 kB
Mlocked: 0 kB
***Output truncated***
I think most sysadmins either use the free
or the top
command to pull some of the data contained here. The /proc/meminfo
file gives me a quick memory overview that I like and can redirect to another file as a snapshot.
/proc/version
The /proc/version
command provides more information than the related uname -a
command does. Here are the two compared:
$ cat /proc/version
Linux version 3.10.0-1062.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Wed Aug 7 18:08:02 UTC 2019
$ uname -a
Linux centos7 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Usually, the uname -a
command is sufficient to give you kernel version info but for those of you who are developers or who are ultra-concerned with details, the /proc/version
file is there for you.
Wrapping up
The /proc
filesystem has a ton of valuable information available to system administrators who want a convenient, non-command way of getting at raw system info. As I stated earlier, there are other ways to display the information in /proc
. Additionally, some of the /proc
info isn't what you'd want to use for system assessment. For example, use commands such as vmstat 5 5
or iostat 5 5
to get a better picture of system performance rather than reading one of the available /proc
files.
[ Need to learn more about Linux system administration? Take a Red Hat system administration course. ]
![Author’s photo](/sysadmin/sites/default/files/styles/user_picture_square/public/pictures/2019-07/Ken_Hess.jpg?itok=4v5vXdjC)
Ken Hess
Ken has used Red Hat Linux since 1996 and has written ebooks, whitepapers, actual books, thousands of exam review questions, and hundreds of articles on open source and other topics. Ken also has 20+ years of experience as an enterprise sysadmin with Unix, Linux, Windows, and Virtualization. More about me