Linux Find Number of CPU Cores Command

To find the number of CPU cores in a Linux system, you can use the nproc command. Simply run the following command in the terminal:

nproc

This will return the number of processing units available on the system. Another alternative is to use the lscpu command which provides detailed information about the system’s CPU architecture:

lscpu | grep '^CPU(s):' | awk '{print $2}'

This will return the number of CPU cores in the same way as nproc.

Leave a Comment