I've been using "du -hs ~/" to get the size of my total home directory with outputs 20GB, and I've been trying to where large files that I can delete to free up some space. However, when using "du -hs ~/*" I get numerous outputted files but they don't sum to 20GB. There are a few hidden files but they aren't shown.
How can I print out the size of hidden files, and also locate the largest files/directories via command line?
Thank you!
The problem lies not with du
but with how the shell resolves *
- it does not include files that start with a period. To remedy, just mention those files explicitly:
du -hs ~/* ~/.*
In order to find the largest of those files, simply pipe the output to a sort
command, with an optional tail
appended:
du -hs ~/* ~/.* | sort -h | tail