Finding the Large Files on a Linux/Ubuntu Server

Reducing space on a server is a never ending task, taking out the big unnecessary large files will speed up the process. A bloated log is an example of files that may be building up on your limited disk space.

This command run on Linux: CentOS, Red Hat, Fedora and Ubuntu via command line will allow you to view the size and location of files at a certain size.

Lets say you want to find all files over 50MB in a certain directory, go to that directory and run:

find . -type f -size +50M -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

You will get a listing of all the files below, if you have many sites on the same disk, just run from the all sites webroot. To change the size increment, you can use ‘G’ for gigabytes or ‘k’ for kilobytes and adjust the number before it to suit.

You are returned a list of files and locations which meet the search criteria.

 

 

Leave all Comment