在命令行处理器数量/核心

问题描述:

我运行下面的命令来获得在Linux中处理器/核心的数量:

I am running the following command to get the number of processors/cores in Linux:

cat /proc/cpuinfo | grep processor | wc -l

它的工作原理,但它看起来并不优雅。建议你将如何改善?

It works but it does not look elegant. How would you suggest improve it ?

NPROC 是您正在寻找的。什么

nproc is what you are looking for.

这里更多:http://www.cyberciti.biz/faq/linux-get-number-of-cpus-core-command/