ScaleScaleScaleScale

Tips / Nginx


How to find large files on Linux

Linux

When you are running out of disk space sometimes you need to search your server to see which files are the ones that are consuming all the disk. And here comes the question, How to find large files on Linux?

First let me tell you that there is not a single command to do this, you can use multiple solutions, however I will show you the most quick and easy ones I use to find and list large files on Linux.

Find large files on Fedora / CentOS / RHEL

Search for big files (50MB or more) on your current directory:

find ./ -type f -size +50000k -exec ls -lh {} ; | awk '{ print $9 ": " $5 }'

Output:

[root@my.server.com:~]pwd
/home

[root@my.server.com:~]find . -type f -size +50000k -exec ls -lh {} ; | awk '{ print $9 ": " $5 }'
./user1/tmp/analog/cache: 79M
./syscall8/public_html/wp.zip: 146M
./bob54/public_html/adserver/var/debug.log: 86M
./marqu35/logs/adserver.site.com-May-2014.gz: 70M
./astrolab72/tmp/analog/cache: 75M

Search in my /var directory for 80MB or max file size:

find /var -type f -size +80000k -exec ls -lh {} ; | awk '{ print $9 ": " $5 }'

Find large files on Debian / Ubuntu Linux

Search in current directory:

find ./ -type f -size +10000k -exec ls -lh {} ; | awk '{ print $8 ": " $5 }'

Search the /home directory:

find /home -type f -size +10000k -exec ls -lh {} ; | awk '{ print $8 ": " $5 }'

If you know other ways to quickly find large files on Linux please share it with us.

Popular search terms:

  • find large files linux
  • cpanel tmp analog
  • cpanel tmp analog cache
  • find largest files linux
profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking

  • Thanks for sharing!
    I always use du to see the size of the subfolders of the current directory:
    du -sh *

  • I would recommend the use of -xdev, to restrict the search to an specific device/mount point. Most of the time we are looking for big files on an specific partition. In my case, I always run “df -h”, then I run find on the partition with less space left.