This post details a pretty simple Linux task but it is one I will need to use frequently as my server fills up, so I am documenting it so I do not have to continue googling. The specific task is to find files greater than a certain size and created more than a certain number of days ago. In this case, I want to delete files larger than 10 gigabytes that were created more than one day ago; the one day stipulation is because I recently created a new file that is 120 gigabytes in size that I need to keep.
The command is:
find <path_to_files> -size +10G -mtime +1 | xargs rm
The size argument returns files larger than 10 gigabytes and mtime returns those older than one day. The Boolean OR pipes the result to rm, which removes all the files that match the size and time constraints.