echo
printf '%smem by proc\n' "$indent_unit"
- ps -eo rss,cmd \
+ ps -eo rss,comm \
| awk -v total="$(free | awk '$1 == "Mem:" {print $2; exit}')" '
NR > 1 {
rss = $1
- cmd = $2
- n = split(cmd, path, "/") # _may_ be a path
- proc = path[n]
+ proc = $2
by_proc[proc] += rss
}
echo "${indent_unit}<->"
- printf '%sTCP: ' "${indent_unit}${indent_unit}"
+ printf '%sTCP\t' "${indent_unit}${indent_unit}"
sudo -n netstat -tnp \
| awk 'NR > 2 && $6 == "ESTABLISHED" {print $7}' \
| awk '{sub("^[0-9]+/", ""); print}' \