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

前端 未结 21 1943
抹茶落季
抹茶落季 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:45

    You could use top -b and grep out the pid you want (with the -b flag top runs in batch mode), or also use the -p flag and specify the pid without using grep.

提交回复
热议问题