Operations 13 min read

Master Linux CPU Info: How to Use lscpu Command and Decode Its Output

This guide explains what the lscpu command does, shows its syntax and options, demonstrates how to view help, retrieve version information, display detailed CPU architecture data in default, parsable and extended formats, and lists important usage tips for Linux administrators.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux CPU Info: How to Use lscpu Command and Decode Its Output

1. Introduction to lscpu command

lscpu is a Linux command that displays detailed information about the CPU architecture, including model, frequency, architecture, and virtualization support.

2. lscpu command usage help

2.1 Command syntax

lscpu [options]

2.2 Command options

Common options for the lscpu command

-a, --all               # print both online and offline CPUs (default is -e)
-b, --online            # print only online CPUs (default for -p)
-c, --offline           # print offline CPUs
-e, --extended[=<list>] # print an extended readable format
-p, --parse[=<list>]    # print a parsable format
-s, --sysroot <dir>     # use the specified directory as the system root
-x, --hex               # print hexadecimal masks instead of CPU lists
-h, --help              # display this help and exit
-V, --version           # output version information and exit

2.3 Getting help

The lscpu command also supports additional options and parameters; you can view detailed usage with lscpu --help .
[root@jeven ~]# lscpu --help

Usage:
 lscpu [options]

Display information about the CPU architecture.

Options:
 -a, --all               print both online and offline CPUs (default for -e)
 -b, --online            print online CPUs only (default for -p)
 -c, --offline           print offline CPUs only
 -e, --extended[=<list>] print out an extended readable format
 -p, --parse[=<list>]    print out a parsable format
 -s, --sysroot <dir>     use specified directory as system root
 -x, --hex               print hexadecimal masks rather than lists of CPUs
 -y, --physical          print physical instead of logical IDs
 -h, --help     display this help and exit
 -V, --version  output version information and exit

Available columns:
           CPU  logical CPU number
          CORE  logical core number
        SOCKET  logical socket number
          NODE  logical NUMA node number
          BOOK  logical book number
        DRAWER  logical drawer number
         CACHE  shows how caches are shared between CPUs
  POLARIZATION  CPU dispatching mode on virtual hardware
       ADDRESS  physical address of a CPU
    CONFIGURED  shows if the hypervisor has allocated the CPU
        ONLINE  shows if Linux currently makes use of the CPU
        MAXMHZ  shows the maximum MHz of the CPU
        MINMHZ  shows the minimum MHz of the CPU

For more details see lscpu(1).

3. Basic usage of lscpu

3.1 Check lscpu version

Use the -V option to view the lscpu tool version.
[root@jeven ~]# lscpu -V
lscpu from util-linux 2.23.2

3.2 Run lscpu directly

lscpu displays information about CPU model, core count, thread count, cache sizes, architecture, and more. Open a terminal and run the lscpu command.
[root@jeven ~]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                6
On-line CPU(s) list:   0-5
Thread(s) per core:    1
Core(s) per socket:    6
Socket(s):             1
NUMA node(s):          1
Vendor ID:             AuthenticAMD
CPU family:            23
Model:                 113
Model name:            AMD Ryzen 5 3600 6-Core Processor
Stepping:              0
CPU MHz:               3593.247
BogoMIPS:              7186.49
Virtualization:        AMD-V
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              512K
L3 cache:              32768K
NUMA node0 CPU(s):     0-5
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 mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl tsc_reliable nonstop_tsc extd_apicid eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr_core retpoline_amd ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec clzero arat npt svm_lock nrip_save vmcb_clean flushbyasid decodeassists overflow_recov succor

lscpu outputs the following fields: Architecture: system architecture (e.g., x86_64). CPU op-mode(s): supported operation modes (32-bit and 64-bit). Byte Order: endianness (Little Endian). CPU(s): number of CPUs (e.g., 6). On-line CPU(s) list: list of online CPUs (e.g., 0-5). Thread(s) per core: threads per core (e.g., 1). Core(s) per socket: cores per socket (e.g., 6). Socket(s): number of sockets (e.g., 1). NUMA node(s): number of NUMA nodes (e.g., 1). Vendor ID: CPU vendor (e.g., AuthenticAMD). CPU family: CPU family number (e.g., 23). Model: CPU model number (e.g., 113). Model name: full model name (e.g., AMD Ryzen 5 3600 6-Core Processor). Stepping: CPU stepping. CPU MHz: current frequency. BogoMIPS: performance metric. Virtualization: virtualization support (e.g., AMD-V). Hypervisor vendor: hypervisor vendor (e.g., VMware). Virtualization type: type of virtualization (full). L1d cache, L1i cache, L2 cache, L3 cache: cache sizes. Flags: CPU feature flags.

3.3 Parsable format (-p) to show CPU topology

Using the -p option displays CPU topology information in a comma‑separated, parsable format.
[root@jeven ~]# lscpu -p
# The following is the parsable format, which can be fed to other programs.
# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
0,0,0,0,,0,0,0,0
1,1,0,0,,1,1,1,0
2,2,0,0,,2,2,2,0
3,3,0,0,,3,3,3,0
4,4,0,0,,4,4,4,0
5,5,0,0,,5,5,5,0

3.4 Extended format (-e) to show CPU details

Using the -e option prints CPU information in an extended, human‑readable format.
[root@jeven ~]# lscpu -e
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE
0   0    0      0    0:0:0:0       yes
1   0    0      1    1:1:1:0       yes
2   0    0      2    2:2:2:0       yes
3   0    0      3    3:3:3:0       yes
4   0    0      4    4:4:4:0       yes
5   0    0      5    5:5:5:0       yes

4. Notes on using lscpu

Be aware that lscpu may behave differently on various operating systems; some options might not be available. Use man lscpu or lscpu --help for detailed documentation. Running lscpu requires basic Linux and hardware knowledge.

Key points to remember:

lscpu works only on Linux systems.

Run it as root or with sudo privileges.

The output contains many fields; select the information you need.

Output may vary across Linux distributions and hardware platforms.

Specific options can retrieve particular data (e.g., -l for logical cores, -p for physical cores).

lscpu can be combined with other commands like grep or awk for further processing.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxShellSystem AdministrationCPU informationlscpu
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.