You can also get detailed file attributes of recently modified files, using -exec option as follows.
![ubuntu find files by date modified ubuntu find files by date modified](https://www.ubuntugeek.com/wp-content/uploads/2021/04/32.png)
To search for files in /target_directory and all its sub-directories, that have been modified in the last 7 days, but not in the last 3 days: $ find /target_directory -type f -mtime -7 ! -mtime -3Īll these commands so far only print out the locations of files that are matched.
#UBUNTU FIND FILES BY DATE MODIFIED UPDATE#
You can also specify the range of update time. To search for files in /target_directory and all its sub-directories no more than 3 levels deep, that have been modified in the last 2 days: $ find /target_directory -type f -mtime -2 -depth -3 To search for files in /target_directory and all its sub-directories, that have been modified in the last 2 days: $ find /target_directory -type f -mtime -2 To search for files in /target_directory and all its sub-directories, that have been modified in the last 60 minutes: $ find /target_directory -type f -mmin -60 If you want to examine directories as well, you can omit -type f option in the command. The above command sorts files in /etc (and all its subdirectories), in the reverse order of their update time, and prints out the sorted list, along with their location and update time. To find the most recently modified files, sorted in the reverse order of update time (i.e., the most recently updated files first): $ find /etc -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r If you would like to find recently updated files on Linux, you can use find command as follows. You want to verify whether/how your Linux file system has been tampered with by someone recently. For example, as a system admin, you have done some configuration on your Linux system, but forgot where it was saved.
![ubuntu find files by date modified ubuntu find files by date modified](https://www.ubuntugeek.com/wp-content/uploads/2021/04/7.png)
There are various occasions where you would like to search for files that have been changed/created in your Linux system recently or within any time frame.
#UBUNTU FIND FILES BY DATE MODIFIED HOW TO#
How to find recently modified files on Linux