Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number of processors/cores in command line

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 ?

like image 699
Michael Avatar asked Oct 27 '13 15:10

Michael


People also ask

How many cores do I have command-line?

Press the Windows key + R to open the Run command box, then type msinfo32 and hit Enter. It should open up the System Information app. Select Summary and scroll down until you find Processor. The details will tell you both how many cores and logical processors your CPU has.

How do I know how many cores my processor has?

Alternatively, you can press Ctrl + Shift + Esc to bring up the Task Manager window, then click on the Performance tab (second from the left). At the top right, you'll see the name of your processor and the number of cores that it has.

How many cpus are in my top command?

The top command is used to display the dynamic real-time view of all running processes in your system. To find out the CPU cores, run top command and press "1" (Number one) to get the CPU core details.


Video Answer


1 Answers

nproc is what you are looking for.

More here : http://www.cyberciti.biz/faq/linux-get-number-of-cpus-core-command/

like image 94
pax162 Avatar answered Oct 19 '22 05:10

pax162