Skip to content

Instantly share code, notes, and snippets.

@francois-blanchard
Last active October 25, 2016 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francois-blanchard/1562d86ccfc363befdfcda15f6f660b2 to your computer and use it in GitHub Desktop.
Save francois-blanchard/1562d86ccfc363befdfcda15f6f660b2 to your computer and use it in GitHub Desktop.
Display top 10 of process using memory (linux)

Display top 10 of process using memory (linux)

$ ps -ewo user,pid,\%cpu,\%mem,cmd:50,comm --sort=-pmem | head -10

Watch it

$ watch -n 1 'ps -ewo user,pid,\%cpu,\%mem,cmd:50,comm --sort=-pmem | head -10'

Historise it

$ crontab -e
> * * * * * ps -ewo user,pid,\%cpu,\%mem,cmd:50,comm --sort=-pmem | head -10 >> /var/log/memory_usage.log 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment