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 want to install a relatively huge package on my Ubuntu 13.10 and I want to use all of the processing cores of my machine. I type

make -j N

where N is the number of available cores+1, I guess. But the problem is that I don't know how many cores do I have. How can I figure it out in Ubuntu?

share|improve this question

migrated from stackoverflow.com Nov 14 '13 at 16:12

This question came from our site for professional and enthusiast programmers.

4 Answers 4

up vote 5 down vote accepted

If you run make -j without any number then it will run as many as it can without limiting to the number you provide.

Linux make man page

share|improve this answer

Try this in your terminal :

cat /proc/cpuinfo | grep processor | wc -l
share|improve this answer

Run lscpu to get information about your cpu.nproc returns the amount of processors

share|improve this answer

@BuysDB definitely has the simplest solution that directly answers the question, but here's another, more cross platform way to do it assuming python is installed:

python -c 'import multiprocessing as mp; print mp.cpu_count()'
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.