在Linux中,要查找昨天的文件,可以使用find命令结合时间参数。以下是一些常用的方法:
使用-mtime参数:
find /path/to/search -type f -mtime 0 find /path/to/search -type f -mtime -1 使用-newermt参数:
find /path/to/search -type f -newermt $(date +%Y-%m-%d) ! -newermt $(date +%Y-%m-%d)T00:00:00 $(date +%Y-%m-%d)表示今天的日期,!表示不包含今天整天的文件,T00:00:00表示今天的开始时间。使用-amin参数:
find /path/to/search -type f -amin -120 -120表示120分钟前,即2小时前。你可以根据实际需求选择合适的方法。注意将/path/to/search替换为你要搜索的目录路径。