Linux online course

How to Identify CPU Information in Linux

Learn how to identify Linux CPU architecture, model, cores, threads, cache, features, and virtualization details with uname, /proc/cpuinfo, lscpu, and nproc.

Linux provides several read-only tools for identifying the processor and the CPU resources visible to the operating system. You can use them to find the CPU model, architecture, logical CPU count, physical topology, cache details, clock information, and supported instruction-set features.

These commands normally require no elevated privileges. Before continuing, it helps to understand basic Linux file structure and how to run commands in a terminal.

Why identify CPU information?

CPU details are useful in several practical situations:

  • Software compatibility: choose a package built for x86_64, ARM, IBM Power, or another architecture.
  • Architecture selection: determine which installer or binary can run on the current system.
  • Performance checks: compare processor models, core counts, cache sizes, and available instruction-set features.
  • Virtualization planning: estimate available sockets, cores, hardware threads, NUMA nodes, and exposed virtualization features.
  • Hardware inventory: record processor vendors, models, topology, and cache information.
  • Troubleshooting: explain missing CPU features, unexpected CPU counts, or software that refuses to run.

CPU identification reports are not all describing the same layer. Hardware information describes the processor and its topology. Kernel and operating-system information describes the Linux kernel currently running and the hardware resources it exposes. A virtual machine or container may therefore report only part of the underlying physical hardware.

Linux sources of CPU information

Linux exposes system information through virtual filesystems. A virtual filesystem does not represent ordinary stored files; the kernel generates its contents when you read them.

  • procfs: mounted at /proc, it exposes kernel-provided process and system information. The file /proc/cpuinfo contains processor details.
  • sysfs: mounted at /sys, it exposes device, CPU, and topology information. The lscpu command uses sysfs and procfs.

/proc/cpuinfo commonly contains one record for each logical CPU. A logical CPU is an execution context visible to Linux. A system with multiple cores or simultaneous multithreading (SMT) can therefore contain repeated model information in multiple records.

Common fields include:

  • vendor_id or an architecture-specific vendor field
  • model name or Hardware
  • processor, the logical processor number
  • cpu family, model, and stepping
  • cpu MHz, when the architecture reports it
  • cache size
  • physical id and core id, where supported
  • flags or an architecture-specific feature list
  • address-size fields describing physical and virtual address widths

Field names and values vary with processor architecture, kernel version, firmware, distribution, and hypervisor. Do not assume that an x86-specific field layout exists on ARM, IBM Z, Power, RISC-V, or other architectures.

Commands at a glance

CommandPrimary purposeTypical informationBest useLimitations

cat /proc/cpuinfo — Detailed kernel-reported data for visible logical processors — Model, vendor, cache, flags, processor records — Per-logical-CPU details — Repetitive and architecture-dependent

uname -p — Request the processor type — Processor-type string — Quick processor query — May print unknown

uname -m — Show machine hardware architecture — Values such as x86_64 or aarch64 — Selecting compatible software — Usually reflects the running kernel, not every physical capability

lscpu — Summarize CPU architecture and topology — CPUs, sockets, cores, threads, caches, NUMA, virtualization — Human-readable inspection — May be absent or host-dependent in guests and containers

nproc — Count processing units available to the current process — A usable CPU count — Build parallelism and process limits — Can differ from hardware totals

Reading the complete report with /proc/cpuinfo

Use cat to display the complete processor report:

cat /proc/cpuinfo

On an x86 system, a record may include a vendor, model name, logical processor number, cache size, clock reading, and feature flags. The same model name may appear repeatedly because each logical processor has its own record.

Find the vendor and model

grep -E 'vendor_id|model name|Hardware' /proc/cpuinfo

This command allows for several common labels. x86 systems often use vendor_id and model name; other architectures may use Hardware or different fields. Repeated lines are expected.

Inspect cache and reported speed

grep -E 'cache size|cpu MHz' /proc/cpuinfo

The cache field may show a cache size associated with each logical processor or a processor-specific value. The cpu MHz value can change because of frequency scaling, turbo operation, idle states, virtualization, or sampling timing. It is not necessarily the advertised base or maximum clock speed.

Inspect CPU feature flags

grep -m1 '^flags' /proc/cpuinfo

Feature flags identify instruction-set extensions and other capabilities exposed to Linux. Flag names are architecture-specific. A missing flag may mean that the processor lacks the feature, firmware or the kernel does not expose it, or a hypervisor has masked it.

Count logical processor records

grep -c '^processor' /proc/cpuinfo

On systems whose procfs format includes the processor field, this counts logical processor entries. It normally counts execution contexts rather than physical cores.

Identifying architecture with uname

The uname command reports kernel and system identification information. Its options answer different questions.

uname -p
uname -m
uname -a

uname -p: processor type

uname -p requests the processor type. Some kernels and platforms cannot provide a useful value and return unknown. That result means this particular query is unavailable; it does not prove that Linux cannot identify the CPU.

uname -m: machine architecture

uname -m is generally the more useful architecture check. It reports the machine architecture used by the running kernel, which is often the value needed when selecting a software package.

OutputGeneral platform familyPackage consideration

x86_64 — 64-bit x86 — Choose 64-bit x86 or amd64 builds

aarch64 — 64-bit ARM — Choose ARM64 or AArch64 builds

armv7l — 32-bit ARM — Choose a compatible 32-bit ARM build

i686 — 32-bit x86 — Choose a 32-bit x86 build; 64-bit packages will not run in the same way

ppc64le — 64-bit little-endian Power — Choose a PowerPC 64-bit little-endian build

s390x — 64-bit IBM Z — Choose an IBM Z or s390x build

Because uname describes the running kernel, it can differ from the full capabilities of the physical processor. For example, a 64-bit physical machine running a 32-bit kernel may report a 32-bit architecture. A guest operating system also sees the architecture presented by its virtual machine.

uname -a: broad system identification

uname -a prints a combined line containing kernel and machine information. It is useful for a quick system overview, but it is not a replacement for the detailed CPU and topology reports.

Summarizing CPU details with lscpu

lscpu is a human-readable summary tool, commonly provided by the util-linux package. Run it without arguments:

lscpu

Depending on the system, the report can include:

  • architecture and operating modes
  • byte order
  • total CPUs and the online CPU list
  • threads per core
  • cores per socket
  • socket count
  • NUMA node count and CPU assignments
  • vendor and model name
  • cache hierarchy and cache totals
  • virtualization information, when available

A useful focused query is:

lscpu | grep -E 'Thread\(s\) per core|Core\(s\) per socket|Socket\(s\)'

A Thread(s) per core value greater than one indicates that SMT is enabled or exposed. Intel commonly calls its SMT implementation Hyper-Threading.

Structured and extended output

Use extended output to view per-CPU topology:

lscpu -e

Use parsable output for scripts:

lscpu -p

Use JSON output on versions that support it:

lscpu -J

JSON and parsable formats are preferable to scraping aligned human-readable columns. Options and exact field names can differ between lscpu versions, so scripts should still validate the output they receive.

Understanding CPU topology

CPU topology describes how processor packages, cores, hardware threads, and memory locality are arranged.

TermWhat it representsRelation to visible CPUsWhere to find it

Socket — A physical CPU package or processor location — One package can contain multiple cores — lscpu; sometimes physical id

Physical core — An independent processing core inside a socket — Each core supplies one or more logical CPUs — lscpu; sometimes core id

Thread per core — Hardware execution threads supplied by each core — SMT can make this greater than one — lscpu

Logical CPU — An execution context visible to Linux — Usually one core or one SMT hardware thread — lscpu, /proc/cpuinfo, nproc

NUMA node — A group of CPUs and nearby memory in a Non-Uniform Memory Access system — Does not directly equal a CPU count — lscpu

When topology is fully reported, the conceptual relationship is:

logical CPUs = sockets × cores per socket × threads per core

For example, a single-socket system with 8 cores and 2 threads per core can expose:

1 socket × 8 cores × 2 threads = 16 logical CPUs

On a two-socket system with 12 cores per socket and 2 threads per core, the total can be:

2 sockets × 12 cores × 2 threads = 48 logical CPUs

Without SMT, a single-socket, 8-core CPU commonly exposes 8 logical CPUs. With SMT, those same 8 physical cores may expose 16 logical CPUs. This is why the number of processor sections in /proc/cpuinfo is usually the logical CPU count, not the physical core count.

A NUMA node is a locality group: memory access is usually faster for CPUs near that node's memory than for CPUs accessing memory attached to another node. NUMA is especially important on larger multi-socket systems.

Choosing and comparing the commands

  • Prefer uname -m for a quick architecture check before downloading software.
  • Prefer lscpu for a concise view of topology, cache hierarchy, virtualization, and architecture.
  • Prefer /proc/cpuinfo for detailed per-logical-CPU fields and feature flags.
  • Use nproc when you need the processing units available to the current process, such as for selecting build parallelism.

Results can legitimately differ. /proc/cpuinfo may list logical processors, lscpu may distinguish configured and online CPUs, and nproc may honor process affinity or container limits. Compare the fields that represent the same concept instead of comparing every number as if it were a total hardware count.

Virtual machines and containers

A virtual machine may present an emulated or deliberately limited CPU model. The guest can see fewer sockets, cores, cache details, or instruction-set flags than the physical host. A hypervisor can also mask features for compatibility or migration between hosts.

Containers share the host kernel but may be constrained by CPU affinity, cpusets, quotas, or namespace visibility. Consequently, the CPU count available to a process in a container may not equal the host's total CPU count.

When inspecting a guest or container:

  1. Run lscpu and check virtualization-related fields when they are present.
  2. Compare the CPU list, online CPU list, and topology fields.
  3. Use nproc to learn how many processing units the current process can use.
  4. Interpret the results as resources visible to the current environment, not necessarily the complete physical host.

Practical identification recipes

Choose a package architecture

uname -m
uname -p

Use the uname -m result to choose a compatible package family. Treat unknown from uname -p as a limitation of that option and use lscpu or /proc/cpuinfo for more detail.

Find the manufacturer and model

grep -E 'vendor_id|model name|Hardware' /proc/cpuinfo
lscpu

The labels differ by architecture, while lscpu usually presents a cleaner summary.

Count available processing units

nproc
grep -c '^processor' /proc/cpuinfo
lscpu

nproc can reflect CPUs available to the current process. The procfs count and lscpu values can follow different visibility rules, especially in a container or virtual machine.

Inspect caches and capabilities

lscpu | grep -i cache
grep -m1 '^flags' /proc/cpuinfo

Cache output may be shown per level or as totals. Feature names are architecture-specific and should be checked against the requirements of the software you are installing.

Troubleshooting

uname -p prints unknown

Some kernels and platforms do not provide a processor-type value for this option. Use uname -m for architecture, then use lscpu or /proc/cpuinfo for model and topology.

lscpu is not found

A minimal installation may not include the util-linux tools. Install the distribution package that provides lscpu when package management is available. Immediate fallbacks are:

uname -m
cat /proc/cpuinfo

The model appears many times

This is normally expected because procfs commonly has one record per logical CPU. Inspect one matching model line or use lscpu for a summary, and count logical CPUs separately.

CPU MHz changes or does not match specifications

Frequency scaling, turbo operation, idle states, virtualization, and reporting differences can all explain this behavior. Treat the value as a current or kernel-reported reading, not a guaranteed base or boost frequency. Use dedicated frequency and power-management tools for real-time frequency analysis.

CPU counts differ

Affinity settings, cpusets, quotas, offline CPUs, container limits, and virtual-machine configuration can produce different counts. Compare the online CPU information from lscpu with the resources available to the process.

Expected flags are absent

The processor may lack the feature, firmware or the kernel may not expose it, or a hypervisor may mask it. Compare host and guest results when appropriate and check the virtual machine's CPU feature-exposure or passthrough settings.

Exam-relevant notes

  • uname -m is generally more reliable than uname -p for identifying the running machine architecture.
  • /proc/cpuinfo commonly reports one section per logical CPU.
  • Logical CPU count is not the same as physical core count.
  • SMT allows one physical core to expose multiple hardware threads.
  • lscpu summarizes topology and commonly reads from both sysfs and procfs.
  • The MHz field is dynamic and should not be treated as the processor's guaranteed maximum speed.
  • CPU information in a virtual machine or container describes the resources exposed to that environment.

Summary

Use uname -m for a quick architecture decision, lscpu for a readable topology and cache summary, and /proc/cpuinfo for detailed per-logical-CPU fields and feature flags. Use nproc when the question is how many processing units the current process can use. Cross-check results by considering sockets, physical cores, SMT threads, online CPUs, virtualization, and container limits.