Last active
November 1, 2023 10:08
-
-
Save JohnRDOrazio/d5806a7ee9074f82704f937f19a96476 to your computer and use it in GitHub Desktop.
List files/folders by size in descending order, limit 20
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
sudo du -hsx --exclude=/{proc,sys,dev,run} /*| sort -hr | head -n20 |
better yet, limit to depth one:
sudo du -hax -d 1 /var | sort -hr | head -n20
this actually seems to work for root directly too, without needing all the excludes...
sudo du -hax -d 1 / | sort -hr | head -n20
This works well when checking current directory:
sudo du -hxs ./* | sort -hr | head -n20
However if you also want to include hidden folders in the results, such as git folders, use this:
sudo du -ahd1 | sort -hr | head -n20
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When checking other paths, you would use
-hax
rather than-hsx
, e.g.:sudo du -hax /var| sort -hr | head -n20