Listing large files in a directory hierarchy

beastie From time to time it can be necessary to free up space on a file system. A quick way to do this is to create a list of large files in a directory hierarchy.

The following example will look for files in a directory hierarchy on a FreeBSD operating system and list files, that has a file size of more than 50 MB. It uses “find” and “du”. The list will be sorted.

su -
find -s /usr/home -size +50M -exec du -h {} \;

The following example will perform the same search on an Ubuntu operating system. This list will not be sorted.

sudo find /home -size +50M -exec du -h {} \;

The implementation of “find” can be different in other operating systems. However, this command will work on other Linux and Unix-like operating systems.

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.


Comments are closed.