Finding the number of processor units

ABOUT nproc

print the number of processing units available

TYPICAL COMMANDLINE SESSION
[bash]
$nproc
2
$nproc –ignore=1
1
$grep -c ^processor /proc/cpuinfo
2
$cat /proc/cpuinfo | awk ‘/^processor/{print $3=$3+1}’ | tail -1
2
$cat /proc/cpuinfo | awk ‘/^processor/{print $3}’
0
1
$lscpu | grep CPU
CPU op-mode(s): 32-bit, 64-bit
CPU(s): 2
On-line CPU(s) list: 0,1
CPU family: 21
CPU MHz: 2800.000
CPU max MHz: 3000.0000
CPU min MHz: 1400.0000
NUMA node0 CPU(s): 0,1
$lscpu | grep "CPU(s)"
CPU(s): 2
On-line CPU(s) list: 0,1
NUMA node0 CPU(s): 0,1
$lscpu | grep "CPU(s):"
CPU(s): 2
NUMA node0 CPU(s): 0,1
$lscpu | grep ^"CPU(s):"
CPU(s): 2
$lscpu | awk ‘FNR == 4 {print $2}’
2
$
[/bash]
LINKS
https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands
http://man7.org/linux/man-pages/man1/nproc.1.html
https://blog.dbi-services.com/linux-how-to-monitor-the-nproc-limit-1/

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