Advertisement
Guest User

Untitled

a guest
Sep 6th, 2020
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1.  
  2. bash command to list top 10 processes using the most ram:
  3. ps -eo rss,comm | sort -nrk 1 | head -n 10 | awk '{ printf "%s %0.2fGiB\n",$2,$1/1024/1024 }'
  4.  
  5. bash command to list top 10 processes using the most swap:
  6. for file in /proc/*/status; do
  7. if [[ `cat $file` =~ Name:[[:space:]]*(.*)[[:space:]].*VmSwap:[[:space:]]*([[:digit:]]*).*kB[[:space:]].* ]]; then
  8. echo "${BASH_REMATCH[2]} ${BASH_REMATCH[1]}";
  9. fi;
  10. done | sort -nrk 1 | head -n 10 | awk '{ printf "%s %0.2fGiB\n",$2,$1/1024/1024 }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement