Skip to content

Instantly share code, notes, and snippets.

@jenkek
Last active November 2, 2018 02:39
Show Gist options
  • Save jenkek/8804503 to your computer and use it in GitHub Desktop.
Save jenkek/8804503 to your computer and use it in GitHub Desktop.
calculate disk usage first level dirs on a volume
$ cd /
# ls -lrt | awk '/^d/ {print $9}'
for dir in `ls -d */`
do
# check those dir which are under /
CHECK_DIR=$(df $dir | awk '( $6 == "/" ) ')
# if dir under / then run du
[[ -z $CHECK_DIR ]] || du -sh $dir
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment