深度阅读

How to search for files modified within a specific time range with the 'find' command in Linux?

作者
作者
2023年08月22日
更新时间
7.52 分钟
阅读时间
0
阅读量

To search for files modified within a specific time range with the ‘find’ command in Linux, you can use the ‘-newerXY’ option followed by a reference file or date.

For example, to find all files modified within the last 7 days, you can use the following command:

find /path/to/directory -type f -newermt "7 days ago"

This will find all files in the specified directory and its subdirectories that were modified within the last 7 days.

You can also specify a specific date and time instead of using “X days ago”. For example:

find /path/to/directory -type f -newermt "2022-09-20 00:00:00" -not -newermt "2022-09-22 00:00:00"

This will find all files that were modified between September 20th, 2022 and September 22nd, 2022.

相关标签

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。