How to explore /proc File system in Linux
To explore /proc File system in Linux
In all linux systems, /proc directory is used. This directory is not a real file system. It is a virtual file system in that procfs are information about processes. /proc is mapped and mount on boot. How to Explore /proc File system in Linux is discussed in this tutorial.
Go to /proc directory
root@linuxhelp:~# ls /
bin dev initrd.img lib64 media proc sbin tmp var
boot etc lib libx32 mnt root srv u01 vmlinuz
cdrom home lib32 lost+found opt run sys usr
root@linuxhelp:~# cd /proc/
root@linuxhelp:/proc# ls
1 1372 152 169 187 2249 6854 cgroups mtrr
10 1377 153 1690 1871 23 7 cmdline net
1059 1378 154 17 188 238 75 consoles pagetypeinfo
11 1383 155 170 189 239 76 cpuinfo partitions
1105 1385 1556 1709 19 24 763 crypto sched_debug
1133 1387 156 171 190 241 781 devices schedstat
11345 1391 1564 1710 191 249 789 diskstats scsi
.
.
.
13 1489 1639 182 205 46 953 loadavg zoneinfo
1300 149 164 183 206 47 954 locks
1312 1490 1647 1832 207 48 985 mdstat
1341 15 165 1838 208 49 994 meminfo
1342 150 1653 184 209 5 acpi misc
1352 1506 166 1846 21 54 asound modules
1354 151 167 185 210 55 buddyinfo mounts
1370 1514 168 186 22 608 bus mpt
As shown above numbered directories represent processes and it is known as PIDs. CPU information (cpuinfo), memory (meminfo), Filesystems that contain system information.
/proc/meminfo contains a bunch of information about your system’ s memory.
Run the cat command on any of the files in /proc to list the information' s as per your requirement.
root@linuxhelp:/proc# cat meminfo
MemTotal: 2039992 kB
MemFree: 339036 kB
MemAvailable: 1450180 kB
Buffers: 51440 kB
Cached: 1056704 kB
SwapCached: 7812 kB
Active: 543216 kB
Inactive: 988652 kB
Active(anon): 192520 kB
.
.
HardwareCorrupted: 0 kB
AnonHugePages: 206848 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 75648 kB
DirectMap2M: 2021376 kB
/proc/cpuinfo contains a bunch of information about your CPU.
root@linuxhelp:/proc# cat cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i5-3330 CPU @ 3.00GHz
stepping : 9
microcode : 0x1b
cpu MHz : 2993.201
cache size : 6144 KB
physical id : 0
.
.
.
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
On /proc’ s files
/proc/cmdline &ndash Kernel command line information.
/proc/console &ndash Information about current consoles including tty.
/proc/dma &ndash Info about current DMA channels.
/proc/devices &ndash Device drivers currently configured for the running kernel.
/proc/fb &ndash Framebuffer devices.
/proc/filesystems &ndash Current filesystems supported by the kernel.
/proc/iomem &ndash Current system memory map for devices.
/proc/ioports &ndash Registered port regions for input output communication with device.
/proc/locks &ndash Files currently locked by kernel.
/proc/loadavg &ndash System load average.
/proc/misc &ndash Miscellaneous drivers registered for miscellaneous major device.
/proc/meminfo &ndash Info about system memory (see above example).
/proc/mounts &ndash List of all mounts in use by system.
/proc/modules &ndash Currently loaded kernel modules.
/proc/pci &ndash Information about every PCI device.
/proc/partitions &ndash Detailed info about partitions available to the system.
/proc/swap &ndash Information about swap space.
/proc/stat &ndash Record or various statistics kept from last reboot.
/proc/version &ndash Kernel version, gcc version, and Linux distribution installed.
/proc/uptime &ndash Uptime information (in seconds).
For example, here we will run the following command to check the status for PID 1597.
root@linuxhelp:/proc# cat 1597/status
Name: gconfd-2
State: S (sleeping)
Tgid: 1597
Ngid: 0
Pid: 1597
PPid: 1216
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
FDSize: 64
.
.
.
CapEff: 0000000000000000
CapBnd: 0000003fffffffff
Seccomp: 0
Cpus_allowed: 00000000,00000001
Cpus_allowed_list: 0
Mems_allowed: 00000000,00000001
Mems_allowed_list: 0
voluntary_ctxt_switches: 228
nonvoluntary_ctxt_switches: 34
Comments ( 0 )
No comments available