Ubuntu Find Largest Files and Directories

First you need to find the largest directory.

cd /
sudo du -xh --max-depth=1 | sort -h

You go now inside the biggest folder and run the same command again and again until you find the folder occupying the most space…

Now to check the 20 biggest files inside /var for example:

sudo find /var -type f -exec du -h {} + 2>/dev/null | sort -rh | head -n 20

The preceding command displays the 20 largest files located within the /var directory.

Leave a Reply

Your email address will not be published. Required fields are marked *