5 Useful Commands To Get CPU Info in Linux
Complete command manual to get CPU information in Linux.
This tutorial brings a compilation of the best commands that we can use in Linux to obtain detailed information about the state of the CPU and in this way have total control over this aspect.
Commands to Get Detailed Info of the CPU in Linux
1. Cat Command
Inside the file /proc/cpuinfo all the information of the processor is stored, and we can have access to its contents thanks to the cat command. For this we must execute the following line:
cat /proc/cpuinfo
The result obtained will be the following:
There we will see details such as:
- Model
- Type of CPU
- Number of CPU cores
- Memory cache , among much more information.
Next, to the cat command, we can add the grep parameter to obtain particular information such as:
cat /proc/cpuinfo | grep 'vendor' | uniq: Display the name of the manufacturer cat /proc/cpuinfo | grep 'model name' | uniq: Displays the model of the processor cat /proc/cpuinfo | grep processor | wc -l: Indicates the number of processors on cores cat /proc/cpuinfo | grep 'core id': Displays cores individually
2. CPUID command
Thanks to the cpuid command, it displays complete information about the processors based on the cpuid of each processor and reflecting the model of each processor.
To install cpuid, we must execute the following lines:
Debian / Ubuntu: sudo apt install cpuid Redhat / CentOS: sudo yum install cpuid Fedora 22 or higher : sudo dnf install cpuid
Once installed, we will run cpuid to obtain the real-time result of the CPU:
3. LSCPU Command
Lscpu displays detailed information about the CPU architecture taking values from the sysfs and /proc/cpuinfo files.
To display this information, just run lscpu in the terminal to see the info:
We can see details such as:
- CPU architecture
- Number of cores
- Number of sockets
- Maker
- Cache, among other features.
4. DMIDCODE Command
This command allows us to obtain information about any component of Linux systems by eliminating the contents of the DMI table, allowing the generated data to be readable by the user.
To obtain the information of the processor in special, we will execute the following line:
sudo dmidecode --type processor
The result will be the following:
5. Inxi Tool
Inxi is a script tool through which we can obtain detailed information about the machine's hardware.
For its installation we will execute the following line:
Debian/ Ubuntu: sudo apt install inxi RedHat/ CentOS: sudo yum install inxi Fedora 22 and higher: sudo dnf install inxi
To obtain information about the maximum CPU speed, CPU information and speed of each kernel, we will add the parameter -C in the following way:
inxi
The result will be the following:
We see the various practical and useful alternatives to obtain detailed information about the state of the processor or CPU in all the Linux distributions and in this way to have better control over them.