Skip to content

Instantly share code, notes, and snippets.

@PROGrand
Created June 2, 2022 08:41
Show Gist options
  • Save PROGrand/1d3112132058afb663e8b2d621c4b36f to your computer and use it in GitHub Desktop.
Save PROGrand/1d3112132058afb663e8b2d621c4b36f to your computer and use it in GitHub Desktop.
How to get linux memory distribution per process
#!/bin/sh
ps -eo size,pid,user,command --sort -size | \
awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |\
cut -d "" -f2 | cut -d "-" -f1 | less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment