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 are 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 have 18 cores. While working with the system you must have information regarding the number of cores. Let’s find out how to check the number of cores on Linux system:

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 Through /proc/cpuinfo File

When we run “lscpu” command, it fetches information from sysfs and /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

After running the above command, press 1:

You can also 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 processors that help any system to work on multiple tasks and enhance the performance. System processors can be dual-core, quad-core (4 cores), and even the latest generation can have 18 cores. We have checked how we can find the number of cores using lscpu, top/htop and nproc commands in the 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.