How To Find the Number of CPU cores

cat /proc/cpuinfo | grep -c processor

or

cat /proc/cpuinfo | grep 'core id'
core id         : 0
core id         : 1

or

nproc

or

lscpu

Subscribe to My Newsletter

The latest programming-related news, articles and resources - sent to your inbox monthly. Unsubscribe anytime.