Linux – How to get all processes running on each CPU core in Ubuntu

cpulinuxprocesspstop

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?

Best Answer

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

UID        PID  PPID  C STIME TTY          TIME CMD
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

Related Question