Linux find largest file in directory recursively using find/du

I have 500GB SSD installed on my Linux server. My web server is running out of the disk space. I need to find a biggest or largest file concerning file size on the disk. How do I find largest file in a directory recursively using the find command?

To find a big file concerning file size on disk is easy task if you know how to use the find, du and other command. The du command used to estimate file space usage on Linux system. The output of du passed on to the sort and head command using shell pipes. Let us see how to find largest file in Linux server using various commands.

Linux find largest file in directory recursively using find

The procedure to find largest files including directories in Linux is as follows:

  1. Open the terminal application
  2. Login as root user using the sudo -i command
  3. Type du -a /dir/ | sort -n -r | head -n 20
  4. du will estimate file space usage
  5. sort will sort out the output of du command
  6. head will only show top 20 largest file in /dir/

Linux find a biggest files in /

Run the command:
$ sudo du -a /dir/ | sort -n -r | head -n 20
$ sudo du -a / 2>/dev/null | sort -n -r | head -n 20

Linux find large files quickly with bash alias

One can hunt down disk space hogs with ducks bash shell alias

## shell alias ##  
alias ducks='du -cks * | sort -rn | head'
### run it ###

How To Find Largest Top 10 Files and Directories On Linux / UNIX / BSD

Finding largest file recursively on Linux bash shell using find

One can only list files and skip the directories with the find command instead of using the du command, sort command and NA command combination:
$ sudo find / -type f -printf "%s\t%p\n" | sort -n | tail -1
$ find $HOME -type f -printf '%s %p\n' | sort -nr | head -10

Sample outputs:

295599646	/home/vivek/backups/
302654548	/home/vivek/backups/books/pdfs/unit443.wmv
313499710	/home/vivek/backups/books/pdfs/magzine.rar
340414464	/home/vivek/.local/share/baloo/index
346359808	/home/vivek/isoimages/VMware-VMvisor-Installer-6.7.0-8169922.x86_64.iso
352256000	/home/vivek/install63.iso
830054400	/home/vivek/linux/linux-4.18.8.tar
1014864333	/home/vivek/backups/corpapp/vsnl_9.5.2_E_21_Linux.tar.gz
1216380038	/home/vivek/backups/books/full.edition.tar.gz
1787822080	/home/vivek/Fedora-Workstation-Live-x86_64-28-1.1.iso

Great! I found the largest files on my disk. What next?

Depend upon file/dir type you can either move or delete the file. For example, you cannot remove or move the Linux kernel or diver directories. To delete unwanted file on Linux use the rm command:
rm -i -v /path/to/file
To get rid of all files and its sub-directories recursively use following command:
rm -rf /path/to/folderName
To move file to a usb pen mounted at /mnt/usb/, run the mv command:
mv /path/to/large/file/ /mnt/usb/


You just learned how to search, find and list largest or biggest directories/files in Linux using the combination of du/find and other commands. For more info see this page or man pages of du and find commands:
man du
man find
man sort
man head
man tail

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • zt01 Jan 17, 2021 @ 5:27

    find command helped me with my shell script as i needed email to see what is going on in /var/www/html/uploads/ directory.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @