I'm trying to run the prstat command on my Ubuntu server, but it doesn't seem to be installed. I have searched the web for the package name needed to install it, but without any luck for some reason.

I'm still surprised that vmstat, iostat and vmstat come pre-installed and work fine but prstat doesn't seem to exist.

  • 3
    To my understanding prstat is Solaris-specific, any reason top or htop are not options? – iruvar Jan 9 '13 at 4:39
  • Interesting, that I didn't know, I have used top and htop and they are useful, but for my current objective I have a created a script that uses prstat and various other stat commands to log specified system behavior and augmenting the script would be very difficult at this stage. I have also noticed that there is a package for Ubuntu: manpages.ubuntu.com/manpages/lucid/man1/prtstat.1.html But not quite sure how to install it.. – I AM L Jan 9 '13 at 5:06
  • If you read that man page, you'll see two things: it's part of the psmisc package, and it is nothing like what the Solaris prstat utility :( – Mat Jan 9 '13 at 6:32
  • @Mat that's a bit disappointing, I guess there's probably no way of porting the prstat functionality to Linux? What is the "BEST" alternative then in this case? – I AM L Jan 10 '13 at 0:42
  • prstat use certain Solaris features (microstate accounting f.e.) that are not available elsewhere – sendmoreinfo Jan 24 '13 at 17:27

prstat is a Solaris command. There are similar commands on Linux (top, ps, reading from /proc, …) but none with the same syntax. It's the downside of using nonstandard tools — porting your application to a different system requires adapting it.

If you really need a tool with the same syntax because of a script that you don't want to change, write one using the features Linux offers. Implement the options and output formats that you need for your script. Most if not all the information you need can be extracted with ps, using the -o option to select fields. Apply a grep or awk filter to select the lines you want. Alternatively, parse /proc/$pid/stat or /proc/$pid/status directly. For global information such as load averages, call top or uptime or look in /proc/stat.

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.