Skip to content

Instantly share code, notes, and snippets.

@sinewalker
Last active August 25, 2017 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinewalker/23626a74d09c96f41390ff79c4c3f621 to your computer and use it in GitHub Desktop.
Save sinewalker/23626a74d09c96f41390ff79c4c3f621 to your computer and use it in GitHub Desktop.
counting CPUs on Linux

I was using this pipeline:

grep -c processor /proc/cpuinfo

However there's a better way: nproc

and for a good summary of CPU info from /sys and /proc/cpuinfo use lscpu which has options to produce parseable output for pipelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment