Skip to content

Instantly share code, notes, and snippets.

@rvflash
Last active November 7, 2018 09:39
Show Gist options
  • Save rvflash/81ae84262bf57c945930f2931f8dcc28 to your computer and use it in GitHub Desktop.
Save rvflash/81ae84262bf57c945930f2931f8dcc28 to your computer and use it in GitHub Desktop.
Returns a top 20 sortered list of used ressources by process
#!/usr/bin/env bash
# Returns a top 20 sortered list of used ressources by process.
for x in `ps -eF| awk '{ print $2 }'`
do echo `ls /proc/$x/fd 2> /dev/null | wc -l` $x `cat /proc/$x/cmdline 2> /dev/null`
done | sort -n -r | head -n 20
@rvflash
Copy link
Author

rvflash commented Nov 7, 2018

# Avoids errors on somes distrib
lsof | tr -s ' ' | cut -d " " -f1-2 | sort | uniq -c | sort -n | tail -n 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment