Skip to content
systemcoding.dev
Fundamentals

List CPU feature flags with grep flags /proc/cpuinfo

List the CPU feature flags on Linux 6.12 with grep flags /proc/cpuinfo, then filter the long line to the few you care about, like avx2 or aes.

1 min read
Summarize in AI

On x86 Linux the kernel prints every CPU feature it detected as one very long flags line per core. You rarely want all of it. grep -m1 stops after the first core, and tr turns the single line into one flag per line so a second grep can pick from it.

Shell
grep -m1 flags /proc/cpuinfo | tr ' ' '\n' | grep -E '^(sse4_2|aes|avx2)$'
Text
sse4_2
aes
avx2

The flags come in the kernel's own order, which follows the CPUID leaves rather than the alphabet, so the output order is not the order you typed them in. To test one feature in a script, grep -qw avx2 /proc/cpuinfo && echo yes is enough: -w stops avx2 from matching avx2_vnni-style names.

The names are the kernel's, listed in arch/x86/include/asm/cpufeatures.h, and some differ from the vendor manuals (sse4_2 for SSE4.2, pni for SSE3). On arm64 the line is called Features, not flags. The file shows what the kernel enabled, not just what the silicon has, so a feature disabled by a boot option or a hypervisor is missing here too.

Also inHardware
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.