How to find all the files that have been created or modified in last few hours?
You may find yourself in a situation when you need to find some files like log files. You know that there are files that have been modified or created recently. You also know that those files are somewhere in the nested directory structure.
How do you list all the recently modified files in Linux?
It’s fairly simple. You can use the find command with the mmin option to list modified files or cmin option to list created files in the following manner:
find <directory_path> -cmin -5
The above command will find all the files that were changed in the last 5 minutes the specified directory. When I say change, it means change on the metadata (i.e. permission) of the files. Most of the time, it will give you the files that were created in last n minutes.
find <directory_path> -mmin -10
The above command will list all the files that have been modified in the specified directory in the last 10 minutes. You can, of course, change the timespan as per your need.
An important point to note here is that the time you specify should be in negative.
I hope this quick Linux command tip helped you to find recently changed files in Linux command line. Feel free to drop a comment with your suggestion or a quick word of thanks.