Retrieve CPU usage and memory usage of a single process on Linux? Retrieve CPU usage and memory usage of a single process on Linux? linux linux

Retrieve CPU usage and memory usage of a single process on Linux?


ps -p <pid> -o %cpu,%mem,cmd

(You can leave off "cmd" but that might be helpful in debugging).

Note that this gives average CPU usage of the process over the time it has been running.


A variant of caf's answer:top -p <pid>

This auto-refreshes the CPU usage so it's good for monitoring.


You can get the results by the name of the process using

ps -C chrome -o %cpu,%mem,cmd

the -C option allows you to use process name without knowing it's pid.