Created
October 25, 2019 17:38
-
-
Save ragaar/6096ddc0136d696efca81470b5f4ad09 to your computer and use it in GitHub Desktop.
Shows the size of files and subdirectories in a directory
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
# Shows the size of files and subdirectories in a directory | |
# Depth of five (5) folders deep; this goes down to the container volumes. | |
# d=5 | |
# Specify a path, should a sub-directory be desired. | |
# p=</path/of/interest>; | |
# Exclude all of the system paths that are not actively written to. | |
# e='--exclude=</path/to/exclude>' | |
# Disk Usage, human-readable, depth, threshold 1GB, path, exclusions | |
# du -h -d ${d} -t 1G ${p} ${e} | |
# Sort alphabetically by the second column (e.g., folder paths). | |
# sort -dk2 | |
d=5; | |
p=/; | |
e='--exclude=/sys --exclude=/proc --exclude=/run --exclude=/dev --exclude=/usr --exclude=/srv --exclude=/opt --exclude=/mnt --exclude=/media --exclude=/boot'; | |
du -h -d ${d} -t 1G ${p} ${e} | sort -dk2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment