How to find memory usage by process?

A simple task one thinks, right?

Well, just recently I needed to find the memory usage for a process and full of confidence, opening a console and start typing ps -……. Damn, what was it again. Let’s google it. Hmm, first page and …  nada.

Keep in mind, I did not want some fancy utility, just a simple command at the terminal, that’s it. To spare you the time digging thru the man pages, here it is. You basically have to construct your own list of parameters with the “-o” switch.

For example, let’s find out how much memory our apache web server uses:

ps -Ao comm -o %mem

ps -A lists all processes, -o omits all formatting and only shows the value that follows. In our case, one for the Command name and one for the memory utilization. You can add whatever info you like and shed light into the inner workings of your server/workstation.

  1. Been looking for this for ages. There are plenty of utilities out there, but I like simple command line.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>