I've been running the following command on my linux box:

watch -d -n 1 "cat /proc/19866/stat"

The pid above is a pid of Nginx's master process - I would expect the following fields to be changing: 14, 15, 16 and 17 as according to kernel docs those should contain amount of time the process has been scheduled in user/kernel mode (14,15) and its children too (16,17), however running this command in watch I noticed that none of those numbers ever change. Can someone shed a bit more light on this ? I'd like to count some CPU usage stats per process and I thought /proc.. was the place to look. Thanks!


Try constructing a simple shell script using the ps command. Based on the implementation, you can get the command to output only those fields that are interesting to you.

| improve this answer | |
  • 1
    but isn't ps reading from /proc too ? At least that's what I thought it was doing... – milosgajdos Jan 6 '13 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.