Finding the largest file recursively on Linux is an easy task if you know how to use the find, du and other commands. The du command is used to estimate file space usage on Linux system. The output of du is then passed on to the sort and head command using shell pipes. Below, you will see how to find the largest file on your Linux machine.
List Largest File Using Find
- Log in as root
- Issue the following command: du -a /dir/ | sort -n -r | head -n 20
The du command above will estimate the file space usage and sort will sort the output of the file space usage.