-
-
Save yumyo/4170929 to your computer and use it in GitHub Desktop.
Unix Directory search
This file contains hidden or 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
To find the largest 10 files (linux/bash): | |
find . -type f -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {} | |
To find the largest 10 directories: | |
find . -type d -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {} | |
Alternatively or a quick view: | |
du | sort -n | |
lists all directories with the largest last. | |
du --max-depth=1 * | sort -n | |
or, again, avoiding the redundant * : | |
du --max-depth=1 | sort -n | |
lists all the directories in the current directory with the largest last. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment