diff --git a/dots/bin/resources.sh b/dots/bin/resources.sh index 4acc936..349ae05 100755 --- a/dots/bin/resources.sh +++ b/dots/bin/resources.sh @@ -16,7 +16,13 @@ displayResources() { elif [[ "${operation}" == "topmem" ]]; then # the process that consumes the most memory echo /home/poq/.config/nwg-panel/icons/noun-ram-8252148.svg - ps -eo pid,cmd,%mem --sort=-%mem | head -n 2 | awk 'NR==2 {printf "%s: %s (%s%)", $1, $2, $4}' + ps -eo pid,%mem,cmd --sort=-%mem | head -n 2 | awk 'NR > 1 { + pid = $1; + mem_percent = $2; + cmd_path = $3; + gsub(/.*\//, "", cmd_path); + {printf "%s: %s (%s%)", pid, cmd_path, mem_percent} + }' elif [[ "${operation}" == "topcpu" ]]; then # the process that consumes the most cpu echo /home/poq/.config/nwg-panel/icons/noun-cpu-8293079.svg