Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a eight core machine. How can I find out how many cores are used by processes that I see in htop?

share|improve this question
up vote 3 down vote accepted

In htop, press F2 or Sto enter setup, then use the arrows to navigate the Columns->Available Columns menu, select PROCESSOR and Enterto add a processor column. Then q to get back to the main screen.

share|improve this answer
This is great, but I believe this only shows WHICH core is being used, it is important to note that each item is still only running on 1 core at a time. The author asked how many cores were in use, not which one. – Caleb Apr 16 '11 at 14:20
For which cores are in use, you can use taskset -pc [pid] – Andrew Lambert Apr 16 '11 at 22:22

I think most of the processes you will see in htop or ps are going to be individual threads or process that each run on one core, but you might notice many apps have several processes going to take advantage of the extra cores.

share|improve this answer

You can use ps -o pid,psr,comm -p <pid>[1], it displays on which core the process runs right now. Do this multiple times, and you get all cores.

For example:

while true; do echo -ne "`ps -o pid,psr,comm -p <pid>`"; done

[1] http://ask.xmodulo.com/cpu-core-process-is-running.html

share|improve this answer

Your Answer


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.