How to find files in a directory that where modified in the last 14 days using Linux

H

How Can We Help?

How to find files in a directory that where modified in the last 14 days using Linux

Type in the following command

find /var/www/ -mtime -14

this will find all files that where modified within the last 14 days within the /var/www/ directory. We use the -mtime test to get all the modified files.

 

To only find .txt files that were modified within the last 14 days within the /var/www/directory we would use this command

find /var/www/ -mtime -14 | grep '\.txt'

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me