I'm looking for a process monitor that produce an easy to parse output to stdout. Is there any tool like that in unix? Something like htop or top, but mean to be consumed by another program.

To be more specific, let's say i want to create a gui program for process monitoring. So, I need to get a real time process information (maybe every second). Do I need to call ps every second, or maybe there's a better alternative?

  • It depends on what you want to monitor. ps -ef should be enough. What are the counters you want to parse and get information? You question is too broad...
    – user34720
    Jun 14 '17 at 17:59
  • updated the question
    – Mas Bagol
    Jun 14 '17 at 18:10
  • Your question isn't still clear enough. What information you want to see(proc usage, memory, name, number of childs, etc). Take a look at my answer...
    – user34720
    Jun 14 '17 at 19:39

Sounds like ps... It can be configured to output specific information on specific processes (or all processes).

If you don’t mind making your program OS-specific, you could also parse whatever ps parses on your system, e.g. /proc on a Linux system.


Top has an option to run and exit, it's called the batch mode. I've used this to get the status of a process in a script in the past.

top -bn1

-b is for batch mode -n1 tells it to run once.

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.