Find Files by Modification Time in linux

Find Files by Modification Time in linux

In Unix-like and some other operating systems, find is a command-line utility that searches one or more directory trees of a file system, locates files based on some user-specified criteria and applies a user-specified action on each matched file.

The find command contains the ability to filter a directory hierarchy based on when the file was last modified:


find / -name "*conf" -mtime 7

find /home/test/ -name "*conf" -mtime 3

The first command returns a list of all files in the entire file system that end with the characters conf and have been modified in the last 7 days.

The second command filters test user’s home directory for files with names that end with the characters conf and have been modified in the previous 3 days.

 

Leave a Reply