Skip to content

[Linux] How to check CPU information

Last Updated on 2021-03-13 by Clay

Linux is an operating system that can do all the functions you imagine

Introduction

CPU (Central Processing Unit) is a most important component in a computer. its main task is following the instructions given by the user. In other words, all the behaviors of our daily use of computer, including opening files, playing music, using editor to record work … etc, are all inseparable from the CPU.

The better CPU can make the computer performance better.

The purpose of this article is not to recommend you to buy a better CPU, but to record what method should we use to obtain GPU information in Linux.

Basically, currently under the Linux operating system, there are roughly three ways to view CPU information:

  • cat /proc/cpuinfo
  • lscpu
  • top/htop

You can use different commands to view CPU information according to your actual needs.


cat /proc/cpuinfo

This is probably the most widely spread method on the Internet. After all, cat is an instruction to directly display the contents of a file on the terminal, and what is recorded in /proc/cpuinfo is the CPU information of our system, which is very intuitive to use.

cat /proc/cpuinfo

Output:

Looks like this

If you think too much information is easy to get confused, you can use the grep command to output only the fields you want to view. For example, we want to check the core of the CPU:

cat /proc/cpuinfo | grep "cpu cores"

Output:

cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4

lscpu

This command is also quite simple, just input it directly in the terminal.

lscpu

Output:

Information will be cleaner than directly cat /proc/cpuinfo

top/htop

top is a command that can monitor the system status on Linux systems, but since the display screen is relatively old, now you will see that people use htop more.

Let’s make a simple comparison.

top

Output:

The above is the output screen of the top command. And htop is like an advanced version with a more beautiful screen and support for mouse clicks. In Debian/Ubuntu systems, you can use the following instructions to install directly:

sudo apt install htop

After installation, directly enter:

htop

Output:

You can find that the displayed information is clearer, and even the CPU usage is visualized at the top.

You can also view CPU information in a way like this.


References


Read More

Tags:

Leave a Reply