commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
this works for a Linux based system, other UNIX systems may have other way(s) to check the number of CPUs.
There are 3 alternatives - vote for the best!
/proc/cpuinfo contains information about the CPU.
Search for "processor" in the /proc/cpuinfo file
wc -l, counts the number of lines.
All Linux Systems I try also have an empty line per cpu in /proc/cpuinfo... little shorter then...
If you can do better, submit your command here.
You must be signed in to comment.