Originally published February 5, 2018 @ 5:53 pm

Every time a filesystem is running out of space and I need to find something to delete, I end up googling the syntax for the find command to make sure it stays off NFS and doesn’t cross mountpoints. Finally, I decided to write this basic script.

Here’s the script. And a few examples on how to use it:

# 20 largest files in /opt/tomcat
large-files /opt/tomcat 20

# 12 largest files in each local filesystem
large-files 12

# 10 largest files in each local filesystem
large-files

Output fields:

DATE           Current date/time
HOST           Short hostname
KB             File size in KB
MTIME          File modification time
UID:GID        User/Group
RWX            Permissions
HL             Number of hardlinks
PATH           File path/name