- 9 Commands to Check CPU Information on Linux
- CPU hardware information
- 1. /proc/cpuinfo
- 2. lscpu — display information about the CPU architecture
- 3. hardinfo
- 4. lshw
- 5. nproc
- 6. dmidecode
- 7. cpuid
- 8. inxi
- 9. Hwinfo
- Conclusion
- 15 thoughts on “ 9 Commands to Check CPU Information on Linux ”
- 9 Useful Commands to Get CPU Information on Linux
- 1. Get CPU Info Using cat Command
- 2. lscpu Command – Shows CPU Architecture Info
- 3. cpuid Command – Shows x86 CPU
- 4. dmidecode Command – Shows Linux Hardware Info
- 5. Inxi Tool – Shows Linux System Information
- 6. lshw Tool – List Hardware Configuration
- 7. hardinfo – Shows Hardware Info in GTK+ Window
- 8. hwinfo – Shows Present Hardware Info
- 9. nproc – Print Number of Processing Units
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- 5 Ways to Check CPU Info in Linux
- Get CPU info with lscpu command
- lscpu command output explanation
- Other commands to check CPU information in Linux
- 1. Check the content of /proc/cpuinfo
- 2. Use lshw command
- 3. Use hwinfo
- 4. dmidecode Command
9 Commands to Check CPU Information on Linux
CPU hardware information
The cpu information includes details about the processor, like the architecture, vendor name, model, number of cores, speed of each core etc.
There are quite a few commands on linux to get those details about the cpu.
In this post we shall take a look at some of the commonly used commands that can be used to get details about the cpu.
1. /proc/cpuinfo
The /proc/cpuinfo file contains details about individual cpu cores.
Output its contents with less or cat.
Every processor or core is listed separately the various details about speed, cache size and model name are included in the description.
To count the number of processing units use grep with wc
To get the actual number of cores, check the core id for unique values
So there are 4 different core ids. This indicates that there are 4 actual cores.
2. lscpu — display information about the CPU architecture
lscpu is a small and quick command that does not need any options. It would simply print the cpu hardware details in a user-friendly format.
3. hardinfo
Hardinfo is a gtk based gui tool that generates reports about various hardware components. But it can also run from the command line only if there is no gui display available.
It would produce a large report about many hardware parts, by reading files from the /proc directory. The cpu information is towards the beginning of the report. The report can also be written to a text file.
Hardinfo also performs a few benchmark tests taking a few minutes before the report is displayed.
4. lshw
The lshw command can display limited information about the cpu. lshw by default shows information about various hardware parts, and the ‘-class’ option can be used to pickup information about a specific hardware part.
The vendor, model and speed of the processor are being shown correctly. However it is not possible to deduce the number of cores on the processor from the above output.
5. nproc
The nproc command just prints out the number of processing units available. Note that the number of processing units might not always be the same as number of cores.
6. dmidecode
The dmidecode command displays some information about the cpu, which includes the socket type, vendor name and various flags.
7. cpuid
The cpuid command fetches CPUID information about Intel and AMD x86 processors.
The program can be installed with apt on ubuntu
And here is sample output
8. inxi
Inxi is a script that uses other programs to generate a well structured easy to read report about various hardware components on the system. Check out the full tutorial on inxi.
Print out cpu/processor related information
To learn more about the inxi command and its usage check out this post:
Inxi is an amazing tool to check hardware information on Linux
9. Hwinfo
The hwinfo command is a hardware information program that can be used to collect details about various hardware components on a Linux system.
It also displays information about the processor. Here is a quick example:
If you don’t use the «—short» option it will display much more information about each cpu core like architecture and processor features.
To learn more about the hwinfo command check this post:
Check hardware information on Linux with hwinfo command
Conclusion
Those were some of the commands to check CPU information on Linux based systems like Ubuntu, Fedora, Debian, CentOS etc.
For some more command examples on checking cpu information check this post:
How to Check Processor and CPU Details on Linux — Command Examples
Most of the commands are command line based and show text output. For a GUI interface use the program called Hardinfo.
It shows hardware details about various components in a easy to use GUI interface.
If you know of any other useful command that can display information about the CPU, let us know in the comments below.
A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected] .
15 thoughts on “ 9 Commands to Check CPU Information on Linux ”
Very nicely explained. I highly recommend it in my articles. thank you.
Thank you for the information, i learn lot in this article. 🙂
Thanks for the Information.
Hi everybody, someone know how to get same information regarding the hardware where I installed a phisical linux ?
Thank you for sharing, it helping lot.
lshw now (DISTRIB_DESCRIPTION=”Linux Mint 17.3 Rosa”) includes a line like below at the bottom of it’s listing:
configuration: cores=4 enabledcores=4 threads=8
How to get the number of real cores, not HiperThreading.
For example, for i7, real cores are 4, but logical are 8. There is some way without root ?
check this post for commands to check the number of real cores.
https://www.binarytides.com/linux-check-processor/
are we still catting into grep?
grep ‘core id’ /proc/cpuinfo
yo Silver Moon, nice write-up bro. absolutelly useful stuff there, though the number of CPUs can be fetched using just ‘grep -c processor /proc/cpuinfo’. take care 🙂
Thank you for the helpful information. You can not look for “unique values” with the “cat /proc/cpuinfo |grep ‘core id’” command on a multiprocessor system. The situation gets even worse with hyperthreading enabled CPU’s.
Источник
9 Useful Commands to Get CPU Information on Linux
In a previous article, we put together a list of 10 useful commands to collect system and hardware information in Linux. In this guide, we will narrow down to the CPU/processor, and show you various ways of extracting detailed information about your machine CPU.
Just to give you an overview, we will query information such as CPU architecture, vendor_id, model, model name, number of CPU cores, speed of each core, and lots more.
Essentially, the /proc/cpuinfo contains this all info, every other command/utility gets its output from this file.
With that said, below are 9 commands for getting info about your Linux CPU.
1. Get CPU Info Using cat Command
You can simply view the information of your system CPU by viewing the contents of the /proc/cpuinfo file with the help of cat command as follows:
To get a little specific, you can employ the grep command – a CLI tool for searching plain-text data for lines matching a regular expression. This can help you only output vendor name, model name, number of processors, number of cores, etc:
2. lscpu Command – Shows CPU Architecture Info
The command lscpu prints CPU architecture information from sysfs and /proc/cpuinfo as shown below:
3. cpuid Command – Shows x86 CPU
The command cpuid dumps complete information about the CPU(s) collected from the CPUID instruction, and also discover the exact model of x86 CPU(s) from that information.
Make sure to install it before running it.
Once installed, run cpuid to collect information concerning the x86 CPU.
4. dmidecode Command – Shows Linux Hardware Info
dmidecode is a tool for retrieving hardware information of any Linux system. It dumps a computer’s DMI (a.k.a SMBIOS) table contents in a human-readable format for easy retrieval. The SMBIOS specification defines various DMI types, for CPU, use “processor” as follows:
5. Inxi Tool – Shows 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 so:
To display complete CPU information, including per CPU clock-speed and CPU max speed (if available), use the -C flag as follows:
6. lshw Tool – List Hardware Configuration
lshw is a minimal tool for gathering in-depth information on the hardware configuration of a computer. You can use the -C option to select the hardware class, CPU in this case:
7. hardinfo – Shows Hardware Info in GTK+ Window
hardinfo displays hardware information in a GTK+ window, you can install it as follows:
Once you have it installed, type:
Linux System Information
It also enables you to generate a system hardware info report by clicking on the “Generate Report” button. From the interface below, click on “Generate” to proceed. Note that you can choose the hardware info category to be generated.
Generate System Information Report
Once you have generated the report in html format, you can view it from a web browser as shown below.
Linux System Detailed Information
8. hwinfo – Shows Present Hardware Info
hwinfo is used to extract info about the hardware present in a Linux system. To display info about your CPU, use the —cpu
9. nproc – Print Number of Processing Units
nproc command is used to show the number of processing unit present on your computer:
For additional usage info and options, read through the man pages of these commands like this:
That’s it for now! You can share with us additional ways of extracting CPU information in Linux via the feedback form below.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник
5 Ways to Check CPU Info in Linux
There are a number of ways you can get information about the processor on your Linux system. I’ll show you my favorite tool for this task along with a few additional ways to check CPUs in Linux.
Get CPU info with lscpu command
This is the simplest command that shows the CPU information in a simple and concise output.
You can see the architecture of your system, number of processors, vendor information, cache information, processor speed etc.
It’s easier to remember as well because it is similar to the ls command. You can think of it as ‘list cpu’.
Well… that’s the processor information for my system and it should look somewhat similar for your Linux system as well.
As you can see, the most important information is that my system has Intel i5-7200U processor. I can go and search on the web for this model number to get more information.
But what does other fields in the output mean? What information do you really have about the processor here? Let me explain it to you. The information is too technical so you should have some basic understanding of the terms here.
lscpu command output explanation
The architecture for my system is 64-bit. Which means it’s a 64-bit processor.
The CPU op-mods are 32 bit and 64 bit meaning that it can operate both as a 32-bit and 64-bit processor. In other words, you can install both 32-bit and 64-bit operating systems on it.
Byte order is Little Endian. Which means that bytes are arranged as per Little Endian order.
The next 4 lines tells you about the number of processors, CPUs/cores and threads. I would suggest reading this article to understand a bit about processors. This picture from Intel also helps in visualizing what socket, CPU, core, threads mean.
Image Source: Intel
We have to go in the reverse order here. My system has 1 socket here which means it has one single chip for the CPUs.
That one socket has 2 cores. It means that the single chip has two physical CPUs on it. This tells you the number of real cores i.e. the actual physical CPUs.
And as you can see, each core has two threads. Threads are basically logical CPUs. The threads share physical execution resources of the physical core but the operating system sees them as separate cores. Read more on hyper- threading here.
In short, my system has one chip that contains two physical CPUs and each CPU is divided into two logical CPUs. And thus my dual core system is seen as having 4 CPUs by the operating system.
There is one NUMA node, the vendor is Intel and the CPU family is 6.
The CPU model number is 142 (not relevant in my opinion) and the model name is Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (most important info).
Stepping is a number used by Intel to identify what level of design change a microprocessor was built to.
The current clock speed of my CPU is 900.054 MHz whereas its maximum capacity is 3100 MHz and 400 MHz.
BogoMIPS is “the number of million times per second a processor can do absolutely nothing”.
Virtualization is VT-x and is used to “help accelerate virtual machines created in VirtualBox, VMware, Hyper-V, and other apps”.
The next four entries are about cache. It has L1D (data cache) of 32K, L1I (instruction cache) of 32K, L2 cache of 256K and L3 cache of 3072K. Read this wiki page to get quick info on CPU caches.
Next is NUMA node for each CPU (both logical and physical CPUs).
The last line is the list of feature flags that are manufacturer specific. You may read more about them here.
This picture summarizes the most important processor information you get from the lscpu command.
Essential CPU information in Linux
In my opinion, lscpu command is more than enough to give you all the information you need.
Other commands to check CPU information in Linux
There are other ways to get CPU info in Linux command line. Let me show them one by one. However, I won’t go in detail to explain their output.
1. Check the content of /proc/cpuinfo
If you are aware of the directory structure in Linux, you already know that proc is a special directory in Linux. It’s actually a virtual filesystem that contains runtime system information such as system memory, devices mounted, hardware configuration etc.
If you want CPU information, you can read the content of the cpuinfo file in proc directory.
You would note that cpuinfo file has detailed information on each core of the processor.
For example, the first core of my CPU has the following information:
If you just want to number of CPU cores (including both physical and logical ones), you can use the grep command with the wc command.
2. Use lshw command
lshw stands for ‘list hardware’. Quite obviously, it means to list the hardware information.
Since the lshw command provides information about all the hardware on your system, it will be difficult to find exactly what you are looking for.
This is why lshw command provides option to narrow down your intended search.
To show only the processor information, you can use the lshw command in the following way:
This will show an output like this:
3. Use hwinfo
hwinfo is another command line tool to get hardware information of your Linux system.
You probably have to install hwinfo tool first. On Debian and Ubuntu, you can use the apt command to install it.
Once installed, you can get the CPU details in this way:
You’ll see an output similar to this for each core of the CPU:
4. dmidecode Command
dmidecode is another command to retrieve various kind of hardware information of your Linux system. You can check memory usage in Linux with it. You can also use it to get only the processor information.
This command needs sudo access as well. You’ll see an output like this:
Conclusion
Of course, there are many more tools that provide you hardware information in Linux. You can utilize them to get CPU info as well.
In my opinion, lscpu is the best command if you don’t want to remember anything. You can also rely on /proc/cpuinfo file. Just use these two and you’ll be set.
Since you learned to check CPU info, maybe you would like to read about checking the disk info in Linux as well.
I hope you liked this tutorial. If you have questions or suggestions, please leave a comment below.
Источник