Last active
November 2, 2018 02:39
-
-
Save jenkek/8804503 to your computer and use it in GitHub Desktop.
calculate disk usage first level dirs on a volume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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