To find the largest file(s) on Ubuntu, you can use the "find" command in combination with the "du", "sort", and "head" commands.
Here is an example:
sudo find / -type f -exec du -h {} + | sort -rh | head -n 3
The above command will return top 3 largest files on your system.
- /: Searches the entire filesystem. Replace / with a specific directory (e.g., /home).
- -type f: Only finds files (not directories).
- -exec du -h {} +: Displays the file size in human-readable format.
- sort -rh: Sorts the files in descending order by size.
- head -n 3: Limits the output to the 3 largest files.