Understanding the /proc/cpuinfo File in Linux

Linux TLDR
Last Updated:
Reading time: 2 minutes

In Linux, “/proc” is a special virtual file system that contains valuable system-related information in different files. Such a file is “/proc/cpuinfo“, which stores detailed information about the CPU, such as vendor ID, CPU family, model name, virtualization features, caches, and many more.

Since it’s a read-only file, you can’t modify it, but you can use the “cat” or “bat” command to view its contents.

$ cat /proc/cpuinfo

Output:

reading the content of cpuinfo file

This file provides much more CPU information compared to other built-in or external tools. If you are familiar with specific fields in this file, you can use other tools such as “grep” or “cut” to extract information from that field, which you can then use in a command or shell script.

For example, the file mentions the CPU model name multiple times, which I want to extract. The condition is that the output should contain only one occurence, disregarding all others. For this purpose, you can use the following command:

$ cat /proc/cpuinfo | grep "model name" | uniq

The above command will search for the “model name” field using the “grep” command and then retain only one occurrence using “uniq” command.

get model name from cpuinfo file

Alternatively, if you only want to output the “model name” value without the field name, you can use the “cut” command for that purpose.

$ cat /proc/cpuinfo | grep "model name" | uniq | cut -d " " -f 3-

The command above will function almost identically to the previous one, except it will output only the third and subsequent fields, omitting the previous two.

get specific flag value from cpuinfo file

This way, you can use the information from “/proc/cpuinfo” in a command or shell script. Now, most of the fields are named in a manner that allows anyone to readily identify and understand the value they represent, except for the flags.

Flags in the /proc/cpuinfo File

The “flags” field in the “/proc/cpuinfo” file contains various flags that define the number of processors attribute. So, let’s see some of the most important flags and understand what information they provide.

FlagDescription
fpuIndicates the presence of a floating-point unit.
vmeVirtual 8086 mode enhancements.
deDebugging extensions.
psePage size extensions.
tscTime stamp counter.
msrModel-specific registers.
paePhysical address extensions.
mceMachine check exception.
apicAdvanced Programmable Interrupt Controller.
sepFast system call.
pgePage global enable.
mcaMachine check architecture.
patPage attribute table.
clflushCache line flush instruction.
mmxMultimedia extensions.
sseStreaming SIMD Extensions.
sse2Streaming SIMD Extensions 2.
syscallSYSCALL and SYSRET instructions.
lmLong mode (64-bit support).
constant_tscTSC ticks at a constant rate.
ssse3Supplemental Streaming SIMD Extensions 3.
fmaFused multiply-add.
pcidProcess-context identifiers.
sse4_1Streaming SIMD Extensions 4.1.
sse4_2Streaming SIMD Extensions 4.2.
avxAdvanced Vector Extensions.
f16c16-bit floating-point conversion instructions.
hypervisorIndicates the system is running under a hypervisor.

The above are a few of the many flags. For a comprehensive list of all flags, along with links for further understanding, refer to this Stack Exchange answer.

Final Word

This article has come to an end. I hope you learned and understood more about the “/etc/cpuinfo” file in this article. If you have any questions or queries about the topic, please leave a comment.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.