From e244cf1bfddd1e551063eee13ea045c93d5614ee Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Jul 2008 09:47:18 +0200 Subject: [PATCH] add script to display the memory usage of a specific program Signed-off-by: Nico Schottelius --- mem_sorted.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 mem_sorted.sh diff --git a/mem_sorted.sh b/mem_sorted.sh new file mode 100755 index 0000000..edb4254 --- /dev/null +++ b/mem_sorted.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +name=apache2 + +for proc in $(pgrep $name); do + pmap -q -x $proc | \ + tail -n +2 | \ + awk '{ + oors=ORS; + ORS=" "; + print $2 "\t"; + i=7; + while(i <= NF) { + print $i; + i=i+1; + } + ORS=oors; + print ""; + }' | \ + sort -g | \ + tail -n 10 + echo From: ${proc} + +done