If you need to find out what the largest files are in a directory and subdirectories here is a command you can run that will find the top 5 largest files.
find . -type f | sed 's/.*/"&"/' | xargs ls -Slh | head -n 5
Breakdown:
- find . -type f: Find all files in this directory and below
- sed ‘s/.*/”&”/’: Put double quotes around the files. xargs can handle this itself, however not all implementations do, this method is safer.
- xargs ls -Slh: Using the filenames from 1 list them all sorted by size.
- head -n 5: Show the output of the first 5 rows. Which becomes the 5 largest files because ls sorted the output.