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/cpuinfocontains processor details. - sysfs: mounted at
/sys, it exposes device, CPU, and topology information. Thelscpucommand 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_idor an architecture-specific vendor fieldmodel nameorHardwareprocessor, the logical processor numbercpu family,model, andsteppingcpu MHz, when the architecture reports itcache sizephysical idandcore id, where supportedflagsor 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
Reading the complete report with /proc/cpuinfo
Use cat to display the complete processor report:
cat /proc/cpuinfoOn 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/cpuinfoThis 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/cpuinfoThe 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/cpuinfoFeature 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/cpuinfoOn 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 -auname -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.
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:
lscpuDepending 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 -eUse parsable output for scripts:
lscpu -pUse JSON output on versions that support it:
lscpu -JJSON 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.
When topology is fully reported, the conceptual relationship is:
logical CPUs = sockets × cores per socket × threads per coreFor example, a single-socket system with 8 cores and 2 threads per core can expose:
1 socket × 8 cores × 2 threads = 16 logical CPUsOn 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 CPUsWithout 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 -mfor a quick architecture check before downloading software. - Prefer
lscpufor a concise view of topology, cache hierarchy, virtualization, and architecture. - Prefer
/proc/cpuinfofor detailed per-logical-CPU fields and feature flags. - Use
nprocwhen 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:
- Run
lscpuand check virtualization-related fields when they are present. - Compare the CPU list, online CPU list, and topology fields.
- Use
nprocto learn how many processing units the current process can use. - 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 -pUse 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
lscpuThe labels differ by architecture, while lscpu usually presents a cleaner summary.
Count available processing units
nproc
grep -c '^processor' /proc/cpuinfo
lscpunproc 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/cpuinfoCache 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/cpuinfoThe 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 -mis generally more reliable thanuname -pfor identifying the running machine architecture./proc/cpuinfocommonly 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.
lscpusummarizes 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.