/proc/cpuinfo and /proc/meminfo files in Linux

Filed Under: UNIX/Linux
Proc Info files

/proc is a directory in the Linux system that contains information about the system.

/proc is not a real file system, rather a virtual file system. It is sometimes also referred to as a process information pseudo-file system. This virtual file system is created on the fly when system boots and is dissolved at the time of system shut down.

It contains runtime system information instead of real files. To gain more information about the proc file read the man page.

We’ll look at two files particularly in /proc file system. /proc/cpuinfo and /proc/meminfo.

The /proc/cpuinfo file

/proc/cpuinfo contains information about the processor, the Linux system is running on. It’s a read-only file.

To view the proc/cpuinfo file use the cat command:

$ cat /proc/cpuinfo
Proccpuinfo File
Proccpuinfo File
processor	: 0
vendor_id	: AuthenticAMD
cpu family	: 23
model		: 1
model name	: AMD EPYC 7501 32-Core Processor
stepping	: 2
microcode	: 0x1000065
cpu MHz		: 1999.650
cache size	: 512 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
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 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr_core ssbd ibpb vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 virt_ssbd arat
bugs		: fxsave_leak sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips	: 3999.30
TLB size	: 1024 4K pages
clflush size	: 64
cache_alignment	: 64
address sizes	: 40 bits physical, 48 bits virtual
power management:

The contents of the file contain information about the processor.

It tells me that the model name of my processor is AMD EPYC 7501 32-Core Processor.

  • Vendor ID represents the name of the vendor that built the processor.
  • Cache size shows the amount of cache memory present.
  • Processor value of 0 indicates a single processor system.
  • Flags field shows which features are available in the CPU.

Together all this information tells the users about the architecture of the system in use.

/proc/meminfo file

This file contains information about the system’s memory usage. To view the file we can use the cat command:

$ cat /proc/meminfo
Procmeminfo 1
MemTotal:        2035428 kB
MemFree:          195028 kB
MemAvailable:    1692724 kB
Buffers:          108020 kB
Cached:          1451608 kB
SwapCached:           16 kB
Active:           539536 kB
Inactive:        1072496 kB
Active(anon):      33308 kB
Inactive(anon):    27948 kB
Active(file):     506228 kB
Inactive(file):  1044548 kB
Unevictable:       18512 kB
Mlocked:           18512 kB
SwapTotal:        524284 kB
SwapFree:         524016 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         70920 kB
Mapped:           171140 kB
Shmem:               676 kB
KReclaimable:     134660 kB
Slab:             179536 kB
SReclaimable:     134660 kB
SUnreclaim:        44876 kB
KernelStack:        2156 kB
PageTables:         2324 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1541996 kB
Committed_AS:     383328 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       19176 kB
VmallocChunk:          0 kB
Percpu:              828 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      102256 kB
DirectMap2M:     1994752 kB
DirectMap1G:           0 kB

The file contains information about free and used memory (both physical and swap) on the system as well as the shared memory and buffers used by the kernel.

Some of the important fields are :

  • MemTotal — Total amount of physical RAM in the system, in kilobytes.
  • MemFree — The amount of physical RAM, in kilobytes, left unused by the system.
  • Buffers — The amount of physical RAM, in kilobytes, used for file buffers.
  • Cached — The amount of physical RAM, in kilobytes, used as cache memory.
  • SwapCached — The amount of swap space, in kilobytes, used as cache memory.

Conclusion

/proc/cpuinfo and /proc/meminfo are a part of the virtual /proc file system. These contain important and detailed information about the system’s processor and memory. Regular users might not require such information, however, system administrators might find it useful. To know more about the proc files read this.

Leave a Reply

Your email address will not be published. Required fields are marked *

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages