in linux •  2 years ago  (edited)

Ever needed to check really quick how many CPUs your *nix machine is running? Maybe you're logged into a remote server, or maybe you just forgot. In any case, I keep finding myself in a such situations and have had to look this up more than once.


Here's a couple ways to go about it. On Linux boxes you can run:

> grep -c processor /proc/cpuinfo
=> 4

Or opt for the less verbose:

> nproc
=> 4

On MacOS:

> sysctl -n hw.physicalcpu
=> 8


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!