Operations 10 min read

How to Retrieve Detailed CPU Information on Linux Using Built‑In Commands

This guide explains multiple Linux techniques—such as lscpu, /proc/cpuinfo, lshw, dmidecode, inxi, hardinfo, hwinfo, cpuid, nproc, and hwloc—to display comprehensive CPU details like model name, core count, cache sizes, architecture, and NUMA nodes, with exact commands and example outputs.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Retrieve Detailed CPU Information on Linux Using Built‑In Commands

Overview

The CPU is the computer’s brain, and Linux provides several built‑in utilities to query its specifications, including model, cores, threads, cache, and architecture. Below are ten practical methods with installation notes, command syntax, and sample outputs.

Method 1 – lscpu

lscpu

reads data from /proc/cpuinfo and sysfs, reporting CPU architecture, mode, core and socket counts, cache sizes, and more. It is part of the util‑linux package, so no extra installation is required.

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:           Little Endian
CPU(s):               4
Thread(s) per core:   2
Core(s) per socket:   2
Socket(s):            1
Vendor ID:            GenuineIntel
Model name:           Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
CPU MHz:              2500.002
L1d cache:           32K
L2 cache:            1024K
L3 cache:            36608K
...

To filter specific fields, pipe the output to grep, e.g., lscpu | grep -i 'Model name' or combine with cut to isolate the value.

Method 2 – /proc/cpuinfo

Reading the virtual file directly shows all processor attributes. Use cat /proc/cpuinfo for a full dump, or filter with grep for items such as "cpu family".

cat /proc/cpuinfo | grep "cpu family"

Method 3 – lshw

lshw

(Hardware Lister) provides detailed hardware configuration, including CPU version and speed. Install it with sudo apt install lshw lshw-gtk, then run: sudo lshw -class processor For a concise list, add the -short flag: sudo lshw -short -class processor A graphical interface is available via lshw gui or sudo lshw-gtk.

Method 4 – dmidecode

dmidecode

reads the DMI table to display hardware components. It is pre‑installed on most distributions. To list processor information:

sudo dmidecode --type processor

Method 5 – inxi

inxi

is a system‑information script that can show CPU details with -C or --cpu. Install it via sudo apt install inxi and run: inxi -C Output includes core count, model, cache, and clock speeds.

Method 6 – hardinfo

hardinfo

is a GUI tool that also generates printable reports. Install with sudo apt install hardinfo, launch it, and select Processor under Devices to view CPU specs.

Method 7 – hwinfo

hwinfo

probes hardware and can display CPU data. Install with sudo apt install hwinfo and run: sudo hwinfo --cpu For a brief summary, use sudo hwinfo --short --cpu.

Method 8 – cpuid

cpuid

dumps information obtained from the CPUID instruction. Install it ( sudo apt install cpuid or sudo dnf install cpuid) and execute:

cpuid

Method 9 – nproc

nproc

(part of GNU coreutils) prints the number of processing units available to the current process: nproc Use nproc --all to show the total number of installed CPUs.

Method 10 – hwloc

hwloc

provides a command‑line tool and C API to display CPU topology, NUMA nodes, caches, and threads. Install with sudo apt install hwloc and run: hwloc-ls The output visualises the hierarchy of sockets, cores, and threads.

These ten methods cover most scenarios for extracting CPU information on Linux, from quick one‑liners to full hardware inventories.

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.

LinuxCPUHardwareSystem Information
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.