You are hereHow Much Memory is My Process Using?

How Much Memory is My Process Using?

By steve - Posted on 27 September 2014

When supporting a linux box, it can be handy to know exactly how much memory a process and all its children are taking up.

I create this handy script when I need to know that...

Run it by typing the command name (memchk or whatever you call it) and the name of the program. Like this:
memchk apache2

ps -ylC $1 | awk '{x += $8;y += 1} END {print "Memory Usage (MB): "x/1024; print "Average Process Size (MB): "x/((y-1)*1024)}'

Don't forget to either put it in the path or specify it. Also, be sure to chmod the file so you can run it as a script.

Did this help you? You can help me!

Did you find this information helpful? You can help me back by linking to this page, purchasing from my sponsors, or posting a comment!

+One me on Google:

Follow me on twitter:


Affiliation Badges