Linux Commands

4 Ways to Find CPU Cores In Linux

CPU Core or we call them CPU Processors are the ones who run machine code. Multiple cores in the system responsible for the execution of multiple program instructions at a time. Some of the systems contain dual-core, some quad-core (4 cores), and even the latest generation can have 18 cores.

Similarly, in Linux operating systems, CPU cores work as processors that help to enhance system performance. While working with the system you must have information regarding processors and their performance.

How To Find CPU Cores In Linux

Linux systems provide several ways to get a detailed picture of a CPU with its cores. This article will cover four top most and easiest ways to get it.

1: Find CPU Cores in Linux Using lscpu Command

The lscpu command is one of the easiest commands in the Linux system to fetch complete details of CPU architecture.

What we need to do is just simply type “lscpu” in the terminal:

$ lscpu

 

2: Find CPU Cores in Linux Using cat/proc/cpuinfo Command

When we run lscpu command, it fetches information from sysfs and cat/proc/cpuinfo. So, it is good to get directly all details by running this command on terminal:

$ cat /proc/cpuinfo

 

3: Find CPU Cores in Linux Using top/htop Command

The top command is used to report processor activities in Linux systems. It displays all the kernel tasks, running Linux processes yet all the system resources. The htop command is one of the iterations of the top command.

Type “top” in the command-line to get complete picture of system:

$ top

 

 

You can either use the “htop” command but it is not pre-installed in Linux Mint 21 system. For this, first install it through the mentioned command:

$ sudo apt install htop

 

Now, run the below-mentioned command to find CPU core in Linux system:

$ htop

 

 

4: Find CPU Cores in Linux Using nproc Command

To display the available processing units in a Linux system, the “nproc” command is used. We can also check all the installed processors on the system using the “nproc all” command. Let’s check how we can find it, run in terminal:

$ nproc --all

 

Conclusion

Cores are basically processors that help any system to work on multiple tasks and enhance their performance. Some of the systems contain dual-core, some quad-core (4 cores), and even the latest generation can have 18 cores.

We have checked how we can find cores using lscpu command, cat/proc/cpuinfo command, top/htop command and nproc command in the Linux system. This article has mentioned four different ways to find CPU cores in a Linux system.

About the author

Syeda Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.