I am working on Ubuntu14.04 server and it has 48 CPU cores. I am seeing there is high CPU usage on one core from sar information. So I want to know which processes are running on that core. How should I get all processes running on each CPU core in Ubuntu?

  • try with top command Commented Mar 8, 2017 at 4:35
  • top command shows processes with all cores. How can I get processes per core. I typed 1 after top command and it gives cpu usage per core but I want processes per core.
    – Rohanil
    Commented Mar 8, 2017 at 4:37

3 Answers 3


You can do that with ps -aeF, see the C column

root         1     0  0  2015 ?        00:08:07 /sbin/init

Or with htop, configure it to show the PROCESSOR column,

enter image description here

To set CPU affinity, you can use taskset command

  • You said ps -aeF, but I had to remove a on our F5 LTM shell... ps -eF worked for me Commented May 7, 2020 at 21:46

Normal top can show the last used CPU, too.

You have to press f while viewing the main screen to enter the Fields Management screen, arrow down to P = Last Used CPU (SMP) and toggle it on with d or space. Press q or escape to return to the main screen.

You may want to move the P column up in the Fields Management screen if you don't like the P column on the far right of the output.

  • This command is really helpful
    – daohu527
    Commented Feb 13, 2022 at 11:38

Realize this is dated but, for those who want to see which processes are using which core with the ps command the column you want is psr. C is cpu utilization.

Cores are numbered 0-N. You can see core details with:

cat /proc/cpuinfo

So let us say you have 4 cores and you want to see all processes using the 4th core:

CORENUM=3; ps -e -o pid,psr,cpu,cmd | grep -E  "^[[:space:]][[:digit:]]+[[:space:]]+${CORENUM}"

Break down of the above command.

Create and set a variable "CORENUM" with value of "3" (the fourth core). End the statement with semi-colon (you could hit enter here).

Run the ps command where: -e = select all processes -o = User defined format. This is made of one or more format specifiers separated by comma. These can be found in the ps man ("man ps") page under section STANDARD FORMAT SPECIFIERS

(use forward slash to search within a man page).

To see a raw list of them you can enter the "L" option (without "-"):

ps L

So here my user defined format is listing the process id followed by processor, then cpu utilization, and finally the command.

This is then piped to grep where I used -E option to enable extended regx in an attempt to accurately output only those processes associated with the cpu number stored in the CORENUM variable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .