首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何记录具体档案的具体修改

问如何记录具体档案的具体修改
EN

Stack Overflow用户
提问于 2017-11-08 10:21:45
回答 1查看 41关注 0票数 0

我想检查linux中一些重要文件(如nginx.conf)的修改历史。如何记录具体文件的具体修改?修改,如什么时候和哪些行的文件被改变。

EN

回答 1

Stack Overflow用户

发布于 2017-11-09 06:43:39

受@Jonathon的评论的启发,我创建了一个shell脚本来监视对特定文件所做的所有更改,同时保留所有更改的历史记录。该脚本取决于正在安装的inotifywait和git包。

你可以在这里找到脚本https://github.com/hisham-hassan/linux-file-monitor

代码语言:javascript
复制
Usage: file-monitor.sh [-f|--file] <absolute-file-path> [-m|--monitor|-h|--history]  
       file-monitor.sh --help  

 -f,--file <absolute-file-path> Adding a file to the monitored files List. The <absolute-file-path>  
                                is the absolute file path of the file we need to action.  
                                PLEASE NOTE: Relative file path could cause issues in the script,  
                                please make sure to use the abolute path of the file. also try to   
                                avoid sym links, as it has not been tested.  
                                example: file-monitor.sh -f /absolute/path/to/file/test.txt -m  
 -m, --monitor                  Monitoring all the changes on the file. the monitoring will keep  
                                happening as long as the script is running; you may need to run it  
                                in the background.  
                                example: file-monitor.sh -f /absolute/path/to/file/test.txt -m  
 -h, --history                  showing the full history of the file.  
                                To exit, press "q"  
                                example: file-monitor.sh -f /absolute/path/to/file/test.txt -h  
 --uninstall                    uninstalls the script from the bin direcotry,  
                                and removes the monitoring history.  
 --install                      Adds the script to the bin directory, and creates  
                                the directories and files needed for monitoring.  
 --help                         Prints this help message.  
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47170539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档