In a previous article, we put together a list of 10 useful commands for collecting system and hardware information in Linux. In this guide, we’ll stick to the CPU/processor and show you several ways to extract detailed information about your machine’s CPU.
Just to give you an overview, we will refer to information such as CPU architecture, vendor_id, model, model name, number of CPU cores, speed of each core, and much more. Essentially, the /proc/cpuinfo contains all this information, all other commands/utilities get their output from this file.
With that said, below are 9 commands to get information about your Linux CPU.
1. Get CPU information using cat command You can simply view your system’s CPU information by viewing the contents of the /proc/cpuinfo file with the help of the cat command
as follows: $ cat /proc/cpuinfo
processor : 0 vendor_id : GenuineIntel CPU family : 6 Model : 69 Model name : Intel(R) Core(TM) i5-4210U
CPU @ 1.70GHz
Version : 1 Microcode: 0x1c CPU MHz : 1700.062 Cache size : 3072 KB Physical ID : 0 siblings : 4 Main ID : 0 CPU Cores : 2 Apicid : 0 Initial Apicid : 0 FPU : Yes fpu_exception : Yes CPUID Level : 13 WP : Yes Flags : FPU VME DE PSE TSC MSR PAE MCE CX8 Apic Sep MTRR PGE MCA CMOV Pat PSE36 Clflush DTS ACPI MMX FXSR SSE SSE2 SS HT TM PBE SYSCALL NX PDPE1GB RDTSCP LM constant_ TSC arch_perfmon PEBS BTS rep_good NOPL Xtopology nonstop_tsc Aperfmperf eagerfpu pni pclmulqdq DTES64 Monitor ds_cpl VMX est tm2 SSSE3 SDBG FMA CX16 XTPR PDCM PCID sse4_1 sse4_2 movbe popcnt tsc_deadline_timer AES XSave AVX F16C RDRAND lahf_lm ABM EPB tpr_shadow VNMI FlexPriority EPT VPID FSGSbase tsc_adjust BMI1 AVX2 SMEP BMI2 ERMS invpcid xsaveopt dtherm ida arat pln pts bugs : Bogomips : 4788.92 Clflush Size : 64 cache_alignment : 64 Address Sizes : 39 Physical bits, 48 bits Virtual Power Management: ……
To be a little specific, you can use the grep command, a CLI tool for finding plain text data for lines that match a regular expression. This can help you generate only the vendor name, model name, number of processors, number of cores, etc.:
$ cat /proc/cpuinfo | Grep ‘Seller’ | Uniq #view provider name $ cat /proc/cpuinfo | GREP ‘Model Name’ | Uniq #display model name $ cat /proc/cpuinfo | Grep Processor | wc -l #count the number of processing units $ cat /proc/cpuinfo | grep ‘core id’ #show individual cores
Suggested reading: How to use the ‘cat’ and ‘tac’ commands with examples in Linux
2. lscpu
command: displays information about the CPU architecture The lscpu command
prints CPU architecture information from sysfs and /proc/cpuinfo as shown below: $ lscpu
Architecture: x86_64 CPU operation modes: 32-bit, 64-bit Byte order: Little Endian CPU(s): 4 List of CPU(s) online: 0-3 Threads per core: 2 Corcore(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU Family: 6 Model: 69 Model name: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz Version: 1 CPU MHz: 1303.687 MHz maximum CPU: 2700.0000 MHz minimum CPU: 800.0000 BogoMIPS: 4788.92 Virtualization: L1d Cache VT-x: 32K L1i cache: 32K L2 Cache: 256K L3 Cache: 3072 K0 NUMA Node CPU(s): 0-3 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 XTPR PDCM PCID sse4_1 sse4_2 Movbe Popcnt tsc_deadline_timer AES XSave AVX F16C RDRAND lahf_lm ABM EPB tpr_shadow VNMI FlexPriority EPT VPID FSGSbase tsc_adjust BMI1 AVX2 SMEP BMI2 ERMS Invpcid XsaveOpt Dtherm ida arat PLN PTS 3. cpuid command
– Displays x86
CPU The cpuid
command dumps complete information about the CPU(s) collected from the CPUID instruction, and also discovers the exact x86 CPU model from that information
. Be sure to install it
before running it.
$ sudo apt install cpuid #Debian/Ubuntu systems $ sudo yum install cpuid #RHEL/CentOS systems $ sudo dnf install cpuid #Fedora 22+
Once installed, run CPUID to collect information about the x86 CPU.
$ CPU CPU 0: vendor_id = “GenuineIntel” (1/eax) version information: processor type = primary processor family (0) = Intel Pentium Pro/II/III/Celeron/Core/Core 2/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 (6) model = 0x5 (5) version ID = 0x1 (1) extended family = 0x0 (0) extended model = 0x4 (4) (single synthesizer) = Intel Mobile Core i3-4000Y / Mobile Core i5-4000Y / Mobile Core i7-4000Y / Mobile Pentium 3500U/3600U/3500Y / Mobile Celeron 2900U (Mobile U/ Y) (Haswell), 22nm Miscellaneous (1/EBX): Process local APIC Physical ID = 0x0 (0) Number of CPUs = 0x10 (16) CLFLUSH Line Size = 0x8 (8) Brand Index = 0x0 (0) Brand ID = 0x00 (0): Unknown Feature Information (1/edx): x87 FPU on chip = true virtual-8086 mode enhancement = true debugging extensions = true page size extensions = true time stamp counter = true RDMSR and WRMSR support = true physical address extensions = true …. 4. dmidecode Command
– Displays
Linux hardware information
dmidecode is a tool to retrieve hardware information from any Linux system. It dumps the contents of a computer’s DMI table (also known as SMBIOS) into a human-readable format for easy retrieval. The SMBIOS specification defines several types of DMI, for CPU, use “processor” as follows:
$ sudo dmidecode -type processor # dmidecode 3.0 Getting SMBIOS data from sysfs. SMBIOS 2.7 present. Handle 0x0004, type DMI 4, 42 bytes Processor Information Socket designation: U3E1 Type: Central Processor family: Core i5 Manufacturer: Intel(R) Corporation Code: 51 06 04 00 FF FB EB BF Signature: Type 0, Family 6, Model 69, Step 1 Flags: FPU (On-Chip Floating Point Unit) VME (Virtual Mode Extension) DE (Debug Extension) PSE (Page Size Extension) TSC (Timestamp Counter) MSR (Specific Registers) of model) PAE (Physical Address Extension) MCE (Machine Test Exception) CX8 (CMPXCHG8 Supported Instruction) APIC (Hardware APIC On-Chip Compatible) SEP (Quick System Call) MTRR (Memory Type Range Registers) PGE (Global Page Enablement) MCA (Machine Verification Architecture) …..
5. Inxi Tool – Displays
Linux System Information
Inxi is a powerful command-line system information script intended for both console and IRC (Internet Relay Chat). You can use it to instantly retrieve hardware information.
You can install like this
: $ sudo apt install inxi #Debian/Ubuntu systems $ sudo yum install inxi #RHEL/CentOS systems $ sudo dnf install inxi #Fedora 22+ To display complete CPU information, including CPU clock speed
and maximum CPU speed (if available), use the -C flag as follows
: $ inxi -C CPU: Dual-core Intel Core i5-4210U (-HT-MCP-) cache: 3072 KB Clock speeds: max: 2700 MHz 1: 1958 MHz 2: 1993 MHz 3: 1775 MHz 4: 1714 MHz
6. LSHW Tool – Hardware Configuration List
LSHW is a minimal tool for collecting detailed information about a computer’s hardware configuration. You can use the -C option to select the hardware class, CPU in this case
: $ sudo lshw -C CPU *-CPU description: CPU Product: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz Manufacturer: Intel Corp. Physical ID: 4 Bus information: [email protected] Version: Intel(R) Core(TM) i5-4210U CPU @ 1.70 GHz Series: To be filled by O.E.M. Slot: U3E1 Size: 2626MHz Capacity: 2700MHz Width: 64-bit Clock: 100MHz Capacities: x86-64 FPU fpu_exception wp vme de pse TSC MSR pae MCE CX8 APIC SEP MTRR Pge MCA CMOV pat PSE36 Clflush DTS ACPI mmx FXSR SSE SSE2 SS HT TM PBE syscall NX PDPE1GB RDTSCP constant_tsc arch_perfmon PEBS BTS rep_good Nopl Xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl VMX est tm2 SSSE3 sdbg FMA cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts cpufreq configuration: cores=2 enabledcores=2 threads=4
7. hardinfo – Displays hardware information
in the GTK+
window hardinfo displays hardware information in a GTK+ window
, you can install it as follows: $ sudo apt install hardinfo #Debian / Ubuntu systems $ sudo yum install hardinfo #RHEL / CentOS systems $ sudo dnf install hardinfo #Fedora 22+
Once you have it installed, type:
$ hardinfo Linux System Information It also allows you to generate a
hardware information
by clicking the “ Generate report“. From the next interface, click “Generate” to continue. Note that you can choose the category of hardware information to generate.
Once you have generated the report in html format, you can view it from a web browser as shown below.
. hwinfo
– Displays current
hardware information
hwinfo is used to extract information about the hardware present in a Linux system. To display information about the CPU, use the command
-cpu $ hwinfo -cpu 01: None 00.0: 10103 CPU [Created on cpu.460] Unique ID: rdCR.j8NaKXDZtZ6 Hardware class: Arch CPU: X86-64 Manufacturer: “GenuineIntel” Model: 6.69.1 “Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz” Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov, pat,pse36, clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,pdpe1gb,rdtscp,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,nopl,xtopology,nonstop_tsc,aperfmperf,eagerfpu,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,sdbg,fma,cx16,xtpr,pdcm,pcid,sse4_1,sse4_2,movbe,popcnt,tsc_deadline_timer, aes, xsave,avx,f16c,rdrand,lahf_lm,abm,epb,tpr_shadow,vnmi,flexpriority,ept,vpid,fsgsbase,tsc_adjust,bmi1,avx2,smep,bmi2,erms,invpcid,xsaveopt,dtherm,ida,arat,pln,pts Clock: 2080 MHz BogoMips: 4788.92 Cache: 3072 kb Units/Processor: 16 Configuration status: cfg=new, avail=yes, need=no, active=unknown ….
9.
nproc – Processing Unit Print Number The nproc command
is used to display the number of processing units present on your computer: $ nproc
For additional information and usage options, read the man pages of these commands like this: $ man commandname
Also, take a look:
- Cpustat – Monitors CPU utilization by running processes on
- CoreFreq – A Powerful CPU Monitoring Tool
- Find the best running processes by higher CPU and memory usage
- How to impose high CPU load and stress testing on Linux using ‘stress-ng’ tool That’s
Linux
for Linux Systems
on Linux
all for now! You can share with us additional ways to extract CPU information on Linux via the feedback form below.