How to get all processes running on each CPU core in Ubuntu?
Solution 1
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,
To set CPU affinity, you can use taskset command
Solution 2
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.
Related videos on Youtube
Rohanil
I am a self-taught Backend developer. My educational background is in Electrical Engineering. I did my specialization in Signal Processing which is equivalent to Data Processing. And from there, I got interest in software development. I have been working as a software developer for the more than 6 years. I worked with Python for the first 2 years. Then I got into Golang for 2 years. I have experience using various tools and frameworks. I have worked professionally using flask, postgresql, mongodb, docker, celery, kafka, influxdb, elasticsearch, git, jenkins, php, javascript, vuejs.
Updated on September 18, 2022Comments
-
Rohanil almost 2 years
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?
-
Mike Pennington about 4 yearsYou said
ps -aeF
, but I had to removea
on our F5 LTM shell...ps -eF
worked for me -
dahohu527 over 2 yearsThis command is really helpful