The following command will list the top 10 biggest files, in descending order of file size, in the current directory.
sudo du -sm ./* | sort -nr | head -n 10
If the top result is a directory, you can cd
into that directory and run the command again until you know what file is taking big space.
The above method is useful if you DO NOT know any characteristics of sought-after files. But if you DO know some characteristics like file name pattern or creation time, you are probably better off using find
find . -name "*.log" | xargs du -m | sort -nr | head -n 10
This command will
- recursively find all files with pattern *.log in the current directory
- sort them based on file size
- return the top 10 biggest files