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:
/proc/cpuinfo contains information about the CPU.
Search for "processor" in the /proc/cpuinfo file
wc -l, counts the number of lines.
There are 4 alternatives - vote for the best!
this works for a Linux based system, other UNIX systems may have other way(s) to check the number of CPUs.
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.