Skip to content

Getting Information About CPU in Linux

There are many tools you can use to get system information on Linux. In this article, we will review some commands that can be used to get information about "CPU (Central Processing Unit)".

uname Command

Using the uname command you can get some basic information about the kernel and CPU:

uname -a command
ali@gnuadmin:~$ uname -a
Linux gnuadmin 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux
The expression "x86_64" in the above output indicates that we have a processor with 64-bit architecture.

lscpu Command

The lscpu command allows you to get more technical information about your processor. With lscpu you can see many data such as CPU virtualization support, cache memory size, number of cores, processor brand and model, number of cores per socket:

lscpu command
ali@zion:~$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          8
On-line CPU(s) list:             0-7
Thread(s) per core:              2
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           94
Model name:                      Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Stepping:                        3
CPU MHz:                         2600.000
CPU max MHz:                     3500.0000
CPU min MHz:                     800.0000
BogoMIPS:                        5199.98
Virtualization:                  VT-x
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        1 MiB
L3 cache:                        6 MiB

/proc/cpuinfo File

By reading the /proc/cpuinfo file, you can get technical details like the lscpu command:

/proc/cpuinfo file
ali@zion:~$ cat /proc/cpuinfo 
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 94
model name  : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
stepping    : 3
microcode   : 0xea
cpu MHz     : 2600.000
cache size  : 6144 KB
physical id : 0
siblings    : 8
core id     : 0
cpu cores   : 4
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes

If you have noticed, there is a statement, processor: 0. I did not write the entire output. However, in the content of this file, you can get information about each core separately. The output above is only a part of the information given about the first core.

Architecture and CPU op-mode Difference

Although you are using a processor with 64-bit architecture, you can run programs compiled for 32-bit. If you are using a 32-bit Linux distribution on your system, you are likely to get output similar to:

Architecture: i686
CPU op-mode(s): 32-bit, 64-bit

The following conclusion can be drawn from here. Although the processor also supports 64-bit architecture; You may be using an operating system with a 32-bit architecture.