#!/bin/bash /usr/bin/printf "%-6s %-9s %s\n" "PID" "Total" "Command" /usr/bin/printf "%-6s %-9s %s\n" "---" "-----" "-------" for PID in `/bin/ps -e | /usr/bin/awk '$1 ~ /[0-9]+/ { print $1 }'` do CMD=`/bin/ps -o comm -p ${PID} | /usr/bin/tail -1` TOTAL=`/usr/bin/pmap ${PID} 2>/dev/null | /usr/bin/tail -1 | /usr/bin/awk '{ print $1 }'` [ -n "${TOTAL}" ] && /usr/bin/printf "%-6s %-9s %s\n" "${PID}" "${TOTAL}" "${CMD}" done | /usr/bin/sort -n -k2