Artur Tyksinski - Sysadmin Blog

Artur Tyksinski - Sysadmin Blog


System Administration Blog by Artur Tyksinski. I talk about anything and everything technology. Mostly Virtualization, MSP, Cyber Security and Linux.

Share


Tags


avrt
Artur Tyksinski - Sysadmin Blog

Find the largest file recursively on Linux

Trying to find the largest file recursively on Linux? It's an easy task if you combine the du, sort and head commands.

Artur TyksinskiArtur Tyksinski

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

  1. Log in as root
  2. 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.

View Comments