Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've got an Ubuntu VM on my Mac. Is there a command I can run in Ubuntu that will tell me how many cores I have to work with?

I could do "about this mac" on the host, but I'm not sure how well the multi-core processor would translate to the VM.

share|improve this question
    
You have configured your VM to have more than CPU, right? (Just making sure) –  Daniel Beck Feb 18 '11 at 6:21

3 Answers 3

This should work:

grep -c processor /proc/cpuinfo

or

lshw -class processor -short
share|improve this answer
    
I tried the grep -c processor /proc/cpuinfo and the output was 4. I'm confused because my box has an i3 in it, and I thought those were dual cores. –  piperchester Aug 18 '12 at 22:07
2  
@Islay: It's because it's hyperthreaded. –  Dennis Williamson Aug 18 '12 at 22:16

On OS X you can use sysctl or system_profiler:

$ sysctl hw.ncpu hw.physicalcpu hw.logicalcpu
hw.ncpu: 8
hw.physicalcpu: 4
hw.logicalcpu: 8
$ sysctl -n hw.ncpu # -n disables printing the names of variables
8
$ system_profiler SPHardwareDataType|grep Cores
      Total Number of Cores: 4

My processor supports hyper-threading, so there are 8 logical cores and 4 physical cores.

share|improve this answer

This command will do the job: dmesg | grep cpu

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.