且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何查找特定文件在给定时间范围内被修改的次数

更新时间:2022-06-27 05:53:17

Linux内核使用 inode 对于文件系统中的文件,这些inode不会记录文件系统中的更改,但是您可以通过mtime示例请求最后一次更改 find testfile -mtime 2 这将告诉您文件是否最后一次更改48小时.

The linux kernel uses inode for files in filesystems these inodes do not log changes in the filesystem, you can however ask for the last change through mtime example find testfile -mtime 2 this will tell you if the file has changed in the last 48 hours.

您正在查看文件的日志更改,可以为此使用inotify.或 inotifywait 工具.让您有效地等待文件中的更改.

You are looking the log changes to the file, you could use inotify for that. Or the inotifywait tool. Which let's you efficiently wait for changes in a file.

我建议inotifywait.

I suggest inotifywait.