Linux获得CPU核数

概览:

获取CPU总核心数

1
echo $(grep -c ^processor /proc/cpuinfo 2>/dev/null)

make多核编译

1
make -j $(grep -c ^processor /proc/cpuinfo 2>/dev/null)
------ 文章已经结束,谢谢你的阅读 ------
------ article has ended,thank you for reading ------
Thanks support Me

---------------- The End ----------------