In this article, we cover how to get CPU related information in AlmaLinux and Ubuntu. Though there are numerous graphical and command-line tools which can provide us the relevant information. The command-line tool which particularly interests us is – lscpu.
The command-line tool – lscpu is a part of util-linux package. The package is installed as default in both the operating systems.
It collects data from architecture specific libraries, /proc/cpuinfo and sysfs and displays it in standard output. Through lscpu we can get information related to CPU Architecture, op-mode, threads per core, cores per socket, Vendor ID, NUMA node, CPU frequency, Model name etc.
CPU related information in AlmaLinux and Ubuntu
Open a terminal and issue the following –
lscpu
If you want to get the size in bytes, use -B option –
lscpu -B
To display CPU cache data –
lscpu -C
To display CPU data in human readable format –
lscpu -e
If we want specific column data –
lscpu -e=online,cpu,maxmhz
Use, –output-all option to get data for all the columns –
lscpu -e --output-all
To get data in JSON format –
lscpu -J
In conclusion, we have covered here how to get CPU related information in AlmaLinux and Ubuntu.
Additional Info –
We can also use cat command-line utility to read the file /proc/cpuinfo to get relevant data –
cat /proc/cpuinfo
If you want only data related to Vendor ID then,
cat /proc/cpuinfo | grep vendor_id
Apart from that, we can also use lshw command –
lshw -class processor
lshw is used to list hardware on our system. -class option is to show only a specific class of hardware which in this case is processor.