How to find CPU information in Linux
Find CPU information in Linux in just a few easy steps
You'll definitely want to know how to find CPU information in Linux. Your computer's CPU is like its powerhouse. Knowing more about it isn't just for tech experts — it's a basic skill that lets you understand how your computer works. Whether you're someone who manages systems, writes code, or just likes digging into your computer, learning to find CPU information in Linux is a useful skill. Besides, if you own one of the best computers, it doesn't hurt to learn a little more about it.
The term CPU refers to the Central Processing Unit, which is the primary component of a computer responsible for executing instructions of a computer program. In Linux, as in any other operating system, the CPU plays a crucial role in carrying out computations and managing the overall system performance.
This article covers four simple methods to access your CPU information so you can find out more about your processor, including how many cores it has, its speed, its cache size, and more.
How to find CPU information in Linux
There are four different methods to accessing CPU information covered in this how-to guide. These are:
- Checking the basic information in Ubuntu settings
- Using the lscpu command
- Accessing the cpuinfo file
- Searching cpuinfo for specific information
1. Ubuntu: Go to Settings > About
You can get some very basic information about your CPU in your Linux distribution (distro). We're using Ubuntu, but other distros will work in a similar way.
In Ubuntu, you can view information about the hardware and operating system by going to Settings and selecting About.
However, it doesn't tell you much, and if you need more information, then you'll need to open the command line interface, which we'll cover in the next steps.
2. Use the lscpu command in the Command Line Interface
You can easily access CPU information from the Command Line interface. Press Crtl-Alt-T to open the Command Line and enter the Linux command lscpu.
When you run this command in a terminal, it provides information about your system's CPUs. Here are some of the details that lscpu typically displays:
- Architecture of the CPU, such as x86_64 (64-bit) or x86 (32-bit)
- Number of CPUs in the system
- Number of CPU cores per physical CPU socket
- Number of hardware threads per CPU core
- Number of CPU sockets
- Vendor ID, or the CPU's manufacturer (e.g., Intel or AMD)
- CPU family, model, and stepping
- Clock speed of the CPU in MHz
- Sizes of the L1, L2, and L3 levels of CPU cache.
- Flags that indicate various features supported by the CPU, such as virtualization support (e.g., VT-x or AMD-V)
3. Access Linux's cpuinfo file
The information generated by the lscpu command is taken from Linux's cpuinfo file in the proc directory. This is a virtual file that the Linux kernel generates on the fly.
You can access the information directly from the cpuinfo file if you want to get more in-depth information about your CPU. However, although there is more information, it is presented in a less easy-to-read format than lscpu results.
To access cpuinfo, press Ctrl-Alt-T to open the Command Line Interface and enter the command cat /proc/cpuinfo
4. Search the cpuinfo file
If you're looking for something specific, you can search for text in the cpuinfo file using the grep command.
Enter the command cat /proc/cpuinfo | grep <search term> | uniq
(uniq filters out duplications.)
In the example above, I searched for the cache size by using the command cat /proc/cpuinfo | grep 'cache size' | uniq
I also searched for 'model name' using the same method.
The grep command provides an effective way to extract specific CPU-related information in Linux, without having to wade through rows of text.
So, that's four ways to check the details of your CPU. There are other methods you can use, such as inxi, cpuid, and hwinfo commands. However, all of these will need to be installed on Linux first as they don't come pre-installed, like the methods we covered above.
Knowing your CPU information provides a fundamental understanding of your system's hardware. Once you know how to access it, you can better appreciate the capabilities and features of your CPU.
Next up, expand your Linux knowledge even further with our other guides. Learn how to add users in Linux, how to find a file in Linux, how to rename a file in Linux, and how to remove a directory in Linux.
Sign up to get the BEST of Tom's Guide direct to your inbox.
Get instant access to breaking news, the hottest reviews, great deals and helpful tips.
Emma Street is a freelance content writer who contributes technology and finance articles to a range of websites, including Tom's Guide, Top10.com, and BestMoney. She has over 15 years of experience working in technical development within the fintech industry. When not writing about tech, Emma can be found writing romantic fiction, reviewing films, and updating her tea blog.