在Ubuntu系统中,有多种工具可以用来监控文件系统的变化和性能。以下是一些推荐的工具及其使用方法:
sudo apt update && sudo apt upgrade -y
sudo apt install cockpit* -y
sudo systemctl start cockpit
和 sudo systemctl enable cockpit
https://<你的服务器IP>:9090
,使用sudo权限用户登录。sudo apt-get install inotify-tools
inotifywait -m -r -e create,modify /root
inotifywatch -r -e create,modify /root
pip install watchdog
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import time
class MyHandler(FileSystemEventHandler):
def on_modified(self, event):
print(f"文件 {event.src_path} 被修改了!")
event_handler = MyHandler()
observer = Observer()
observer.schedule(event_handler, path='.', recursive=False)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
这些工具可以满足不同用户在Ubuntu系统中对文件系统监控的需求,从简单的命令行工具到图形化界面,用户可以根据自己的喜好和具体需求选择合适的工具。