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

前端 未结 21 1918
抹茶落季
抹茶落季 2020-11-27 09:00

I want to get the CPU and memory usage of a single process on Linux - I know the PID. Hopefully, I can get it every second and write it to a CSV using the \'watch\' command

21条回答
  •  清酒与你
    2020-11-27 09:58

    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.

提交回复
热议问题