Show the number of CPU cores and sockets on your system

Assalamualaikum,

With multicore CPUs it’s easy for newbies to get confused when faced with questions like;

1. How many physical CPUs does the server have?
code:
# cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l

2. How many cores per CPU?
code:
# cat /proc/cpuinfo | grep 'cpu cores' | uniq

3. List all virtual core.
code:
# cat /proc/cpuinfo | grep '^processor'

4. How many virtual processors?
code:
# grep -c ^processor /proc/cpuinfo
or
# cat /proc/cpuinfo | awk '/^processor/{print $3}'| wc -l
or
# nproc --all

thanks,

ref1: https://unix.stackexchange.com/questions/218074/how-to-know-number-of-cores-of-a-system-in-linux
ref2: https://access.redhat.com/discussions/480953

This entry was posted in Linux and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s