QUESTIONS CENTRECategory: apacheHow can I find large files in Unix with SSH command?
ZENHOST Support Staff asked 9 years ago

Are you looking around for a series of commands that will show you the largest files on a drive?

If you just need to find large files, you can use find with the -size option. The next command will list all files larger than 10MiB

Use this following command to find files larger than 10MiB

find / -size +10M -ls

If you want to find files between a certain size, you can combine it with a “size lower than” search. The next command find files between 10MiB and 12MiB:

find / -size +10M -size -12M -ls

This example is when we need to make more free space on servers we can use this command.

You find all files bigger then 50 MB and “du -h” make better list of files and “sort -n” after pipe make list numericcaly sorted by file size.

find / -size +50M -type f -exec du -h {} \; | sort -n