Skip to content

Instantly share code, notes, and snippets.

@ianhomer
Last active October 16, 2015 08:38
Show Gist options
  • Save ianhomer/5d7d22544ce0871d3599 to your computer and use it in GitHub Desktop.
Save ianhomer/5d7d22544ce0871d3599 to your computer and use it in GitHub Desktop.
Diskspace
# If syslog is big then you can rotate log and then clear up
savelog -g adm -m 640 -u root -c 7 /var/log/syslog
# Get summary
df -m
# Size of top level directories in Mb in alphabetical order (so you can see if any take a long time to process)
ls / | sort
ls / | sort | grep -v "usr" | xargs -n 1 du -m -d 0 2>/dev/null
ls . | sort | grep -v "usr" | xargs -n 1 du -m -d 0 2>/dev/null
( cd /opt/mydirectory ; ls . | sort | grep "id" | xargs -n 1 du -m -d 0 2>/dev/null | sort -n )
# Then drill into each
du -ma -d 1 /home 2>/dev/null | sort -rn
du -ma -d 1 /lib 2>/dev/null | sort -rn
du -ma -d 1 /usr 2>/dev/null | sort -rn
du -ma -d 1 /var 2>/dev/null | sort -rn
du -ma -d 1 /tmp 2>/dev/null | sort -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment