Skip to content

Instantly share code, notes, and snippets.

@geekpete
Last active October 19, 2016 00:24
Show Gist options
  • Select an option

  • Save geekpete/e59bb5d5aec3a560383eca2876688610 to your computer and use it in GitHub Desktop.

Select an option

Save geekpete/e59bb5d5aec3a560383eca2876688610 to your computer and use it in GitHub Desktop.
view top memory consuming processes with some loops of the ps command
#!/bin/bash
for x in $(seq 1 10); do echo $x; echo `date` >> /tmp/top-output.txt; ps -eo rss,pmem,pid,cmd | sort -nr >> /tmp/ps-output.txt;sleep 5; done
#!/bin/bash
# uses "command" column name in place of "cmd" to work on OSX
for x in $(seq 1 10); do echo $x; echo `date` >> /tmp/top-output.txt; ps -eo rss,pmem,pid,command | sort -nr >> /tmp/ps-output.txt;sleep 5; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment