Linux

Check Application Memory usage using simple command

To check the total amount of memory used by any program’s child processes:

Create a shell script
# vim checkmem.sh

Contents:

echo “————————————-Memory Checkup————————————“;

ps -ylC $1 –sort:rss | awk ‘!/RSS/ { s+=$8 } END { printf “%s\n”, “Total memory used by child processes: “; printf “%dM\n”, s/1024 }’

Run Script with a argument whose child processed needs to be calculated:

sh checkmem.sh nginx

————————————-Memory Checkup————————————
Total memory used by child processes:
5679M

Download checkmem.sh

You Might Also Like