The /proc
filesystem appears to always exist because it's built at boot time and is removed at shutdown, but it is actually a virtual filesystem that contains a lot of relevant information about your system and its running processes. In this article, I'll take a deep dive into its contents and what value you, as a sysadmin, can glean from it.
Note: I'm accessing files and directories under
/proc
as a standard user and not as root unless otherwise noted.
If you look at the files under /proc
, you'll see a lot of them (150+), depending on how many processes you have running.
$ ls /proc
1 174 26 2902 4109 531 fb
10 175 2601 2904 41275 546 filesystems
1004 176 2602 2907 41292 547 fs
<snip>
166 2589 2889 4000 47452 dma vmstat
167 2594 2898 4005 475 driver zoneinfo
168 2595 29 40986 522 execdomains
The numbered files are directories that correspond to process numbers or process IDs (PIDs). For example, in the first column, there are processes with the numbers 1, 10, 1055, 1057, 1059, and so on. Inside those process-numbered directories, there are more files that have to do with the processes themselves. Below is a listing of the /proc/411
directory.
$ ls /proc/411
ls: cannot read symbolic link /proc/411/cwd: Permission denied
ls: cannot read symbolic link /proc/411/root: Permission denied
ls: cannot read symbolic link /proc/411/exe: Permission denied
arch_status fdinfo numa_maps smaps_rollup
attr gid_map oom_adj stack
autogroup io oom_score stat
auxv latency oom_score_adj statm
cgroup limits pagemap status
clear_refs loginuid patch_state syscall
cmdline map_files personality task
comm maps projid_map timers
coredump_filter mem root timerslack_ns
cpuset mountinfo sched uid_map
cwd mounts schedstat wchan
environ mountstats sessionid
exe net setgroups
fd ns smaps
There are a few files in each directory that regular users can't read. To list or open those files, you have to be root.
[ If you'd like to see a practical use of /proc's info, check out: How to clear swap memory in Linux ]
You'll notice that a long listing (ls -l /proc
) reveals that the regular text files have a size of 0. Ordinarily, a zero-sized file means that it contains no content. However, these /proc
files, like the /proc
filesystem itself (procfs
), are virtual. They do contain information or else why would they be there?
For example, display the cpuinfo
file to the screen and you'll see what I mean.
$ 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 file contains information about your CPU(s). Many of the regular text type files contain hardware and system information and you may cat
them as you would any other text file. Remember to ignore that zero file size.
In the next installment of this /proc
filesystem series, I'll explain the information given in the files. You can explore for yourself, too. Most of the files have names that describe the information that they contain. Some files are more valuable than others to the human mind. Not every file has cpuinfo
or meminfo
-level information in it that's valuable to a sysadmin, but the information is possibly important to developers, hardware manufacturers, or vendor troubleshooting personnel.
[ Need to learn more about Linux system administration? Consider taking a Red Hat system administration course. ]
About the author
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.
Follow him on Twitter: @kenhess for a continuous feed of Sysadmin topics, film, and random rants.
In the evening after Ken replaces his red hat with his foil hat, he writes and makes films with varying degrees of success and acceptance. He is an award-winning filmmaker who constantly tries to convince everyone of his Renaissance Man status, also with varying degrees of success and acceptance.
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit