How to find files modified less than X days ago on Linux, Mac and BSD

In Linux, Mac and BSD, you can search for all files modified in the last 60 days. Of course, you might as well search for a particular file extension if you know it.

find ~ -name '*.m' -type f -mtime -60
-name "*.m"
You need to enclose in quotes “ “ to avoid the shell expanding the asterisk into a giant list of files. This parameter is optional
-type f
save time by searching only files, not directories (especially helpful the other way around where you want only directories)
-mtime -60
searches for files modified within the last 60 days (not older files)

Tags: , ,


Written by Michael Hirsch, Ph.D. //