LinuxCommandLibrary

cpuid

Display CPU identification and feature information

TLDR

Display information for all CPUs

$ cpuid
copy

Display information only for the current CPU
$ cpuid [[-1|--one-cpu]]
copy

Display raw hex information with no decoding
$ cpuid [[-r|--raw]]
copy

SYNOPSIS

cpuid [options] [EAX_LEAF]

PARAMETERS

--raw, -r
    Display raw hexadecimal values only.

--std, -s
    Display standard leaves (0x0-0x1F) only.

--ext, -x
    Display extended leaves (0x80000000-0x8000001F) only.

--level=LEVEL, -l LEVEL
    Specify the maximum CPUID level to dump.

--sockets=N, -S N
    Specify N CPU sockets to dump information from.

--cpu=N, -c N
    Specify N logical CPUs (cores/threads) to dump information from.

--force, -f
    Force dumping even if no CPUID driver is loaded (may not work).

--version, -v
    Display version information.

--help, -h
    Display a help message.

--iso, -i
    Output ISO 9362 characters (for decoding specific fields).

--physical-cpu=N, -p N
    Dump information for a specific physical CPU (socket) N.

--quiet, -q
    Suppress error messages.

--decode-all, -D
    Attempt to decode all possible CPUID leaves (can be slow).

--endian=ORDER, -e ORDER
    Set endianness for raw output (le/be for little/big endian).

--decoding-level=N, -d N
    Set the decoding level for all possible leaves.

--core=N, -C N
    Dump information for core N on the current socket.

--thread=N, -T N
    Dump information for thread N on the current core.

EAX_LEAF
    A hexadecimal value representing a specific CPUID leaf to query. E.g., '0x1' for processor info and feature bits.

DESCRIPTION

The cpuid command is a Linux utility designed to extract and display detailed information about the system's Central Processing Unit(s). It directly interacts with the CPU's built-in CPUID instruction, which provides low-level insights into the processor's architecture, features, vendor, family, model, stepping, cache topology, and supported instruction sets. This tool is invaluable for hardware diagnostics, performance tuning, and understanding the capabilities of a specific CPU. It can output either a comprehensive dump of all recognized CPUID leaves or query specific leaves by their hexadecimal EAX value. Access to the /dev/cpu/N/cpuid device file, provided by the cpuid kernel module, is typically required, often necessitating root privileges.

CAVEATS

Access to the /dev/cpu/N/cpuid device file, managed by the cpuid kernel module, is required for most operations. This usually means the command must be run with root privileges.
The output can be highly technical and extensive, making it less suitable for casual users. The --force option might attempt to bypass the driver requirement but is unlikely to succeed without the underlying kernel support.

DIRECT CPU INTERACTION

Unlike higher-level tools like lscpu or /proc/cpuinfo, which parse information gathered by the kernel at boot time, cpuid directly executes the CPUID instruction at runtime. This provides the most immediate and raw view of the processor's capabilities, making it indispensable for low-level diagnostics and development.

KERNEL MODULE AND PERMISSIONS

For cpuid to function correctly, the cpuid kernel module must be loaded (e.g., via `modprobe cpuid`), creating device files such as /dev/cpu/0/cpuid. These files typically require root access for reading, hence why cpuid is often run with sudo.

HISTORY

The CPUID instruction itself was introduced by Intel with the Pentium processor to allow software to identify CPU features dynamically. The cpuid Linux utility was developed by H. Peter Anvin to expose this instruction's output in a user-friendly command-line format. Its development parallels the increasing complexity and feature sets of modern CPUs, requiring a programmatic way to enumerate capabilities.

SEE ALSO

lscpu(1), /proc/cpuinfo, x86info(1)

Copied to clipboard