Skip to content

Instantly share code, notes, and snippets.

@jdforsythe
Created July 13, 2017 12:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdforsythe/70f8091e20ef76e5517c8574f43a9409 to your computer and use it in GitHub Desktop.
Save jdforsythe/70f8091e20ef76e5517c8574f43a9409 to your computer and use it in GitHub Desktop.
Highest disk usage offending processes
#!/bin/bash
## requires iotop to be installed
sudo iotop -botqqqk --iter=600 >> iotop.log
cat iotop.log \
## remove characters before write speed
| cut -c 41- \
## look for any write speed that is non-zero
| grep -P "^ *(0\.([1-9]\d|0[1-9])|[1-9]\d\.\d\d) K/s" \
## remove characters before the process name
| cut -c 30- \
## this sort makes uniq -c much faster
| sort \
## count unique lines
| uniq -c \
## sort by number descending
| sort -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment