I needed to find all files on a Linux box that had been modified in the last 24 hours. Years ago I used to have a custom Perl script for such things, which I would use for various software development projects, but I found this awesome command:
find / -type f -mtime -1 -exec ls -al {} \;
You can change the ‘/’ if you want to look somewhere specifically, like your home directory, or /etc. Of course you can pipe it to grep for just grabbing certain matches. The -1 specifies 1 day. I always love finding simple commands that are so powerful.
Oh, I found that bit at DZone Snippets, it’s titled Search for files modified the last … days.
1 reply on “Finding modified files”
Oh, and if you’re using GNU find (i.e., if you’re on Linux), it’s even simpler:
$ find / -type f -mtime -1 -ls
Of course, the output of “find -ls” is not the same as the output from “ls -l” but unless you’re actually parsing the output, does it matter? It’s close enough for human eye-parsing.