add script to display the memory usage of a specific program
Signed-off-by: Nico Schottelius <nico@denkbrett.schottelius.org>
This commit is contained in:
parent
f22fa3910b
commit
e244cf1bfd
1 changed files with 24 additions and 0 deletions
24
mem_sorted.sh
Executable file
24
mem_sorted.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue