How to check CPU information through command line in Unix based operating systems

Sometimes you need to find information about your CPU on your Linux machine and there are many ways to do it. So in this tutorial I will teach you how to find details about your CPU such as processor, architecture, vendor name and many others that are very useful to you.

I like to learn how to do the same thing in different ways, especially when it comes to the Linux command line because it makes me practice many things and I feel closer to my dream of being a ninja.

The /proc/cpuinfo is a read-only file that contains information about the central processing units on a machine. You can easily read its content and display it to the terminal on standard output by using the cat command. Open a new terminal (CTRL+ALT+T in Ubuntu) and run the following command.

What's the one thing every developer wants? More screens! Enhance your coding experience with an external monitor to increase screen real estate.

cat /proc/cpuinfo

As you guys can see from the output shown below, the above command gave me detailed information about each individual CPU processor such as the vendor id, model, CPU family, model name etc.

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
stepping : 7
microcode : 0x28
cpu MHz : 800.000
cache size : 3072 KB
physical id : 0
siblings : 4
core 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 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 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips : 4589.51
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

You can also find the number of processors by using the following command. I did an entire article on how to find the number of processors on your Linux machine.

cat /proc/cpuinfo | grep processor | wc -l

The following command will help you to get the vendor id of processors without printing the entire content of the /proc/cpuinfo file on your screen.

cat /proc/cpuinfo | grep vendor_id

I have four processors, so the following is the output I get when running the above command.

vendor_id : GenuineIntel
vendor_id : GenuineIntel
vendor_id : GenuineIntel
vendor_id : GenuineIntel

A very simple and useful command that can be used to gather information on CPU architecture like the like number of CPUs, threads, cores, sockets, NUMA nodes, information about CPU caches, CPU family, model and bogoMIPS is the lscpu utility.

The lscpu tools pulls the information from from sysfs and /proc/cpuinfo file, and prints it in a human-readable format, so everyone can understand it. Unfortunately it does not have many options so there is not much you can do with it.

Open a new terminal (CTRL+ALT+T) and run the following command to get information about your cpu hardware details in your linux machine.

lscpu

After running the above command, I get the following output.

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 42
Stepping: 7
CPU MHz: 800.000
BogoMIPS: 4589.51
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3

As you guys can see the output of the lscpu command is in a human-readable format and easier to read than the output we pulled manually from the /proc/cpuinfo file, but it does not provide many details for a linux geek. It is very useful for creating a basic idea for your CPU.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Leave a Reply

Your email address will not be published. Required fields are marked *

*