Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I wonder how to get how many cores (including emulated via HT and such) are avaliable to user via bash shell-script command?

share|improve this question
    
On what operating system? –  Mat Jan 15 '12 at 8:44
    
Debian, Ubuntu, OpenSuse, MacOsX –  myWallJSON Jan 15 '12 at 9:25
add comment

1 Answer 1

up vote 6 down vote accepted

On Linux:

grep ^processor /proc/cpuinfo | wc -l
share|improve this answer
7  
Or try grep -c ^processor /proc/cpuinfo and you won't need to spawn two processes. –  Alexios Jan 15 '12 at 10:36
add comment

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.