You can use the following commands to find what files or folders taking too much space.
E.g. to display the biggest top 20 directories in the current folder, use the following one-liner:
du -ah . | sort -rh | head -20
or:
du -a . | sort -rn | head -20
For the top 20 biggest files in the current directory (recursively):
ls -1Rs | sed -e "s/^ *//" | grep "^[0-9]" | sort -nr | head -n20
or with human readable sizes:
ls -1Rhs | sed -e "s/^ *//" | grep "^[0-9]" | sort -hr | head -n20
The second command to work on OSX/BSD properly (as sort
doesn't have -h
), you need to install sort
from coreutils
. Then add the bin folder to your PATH
.
You can define these commands as aliases (e.g. add to your rc files such as .bash_profile
):
alias big='du -ah . | sort -rh | head -20'
alias big-files='ls -1Rhs | sed -e "s/^ *//" | grep "^[0-9]" | sort -hr | head -n20'
Then run big
or big-files
inside the folders which you think take place (e.g. in /home
).