Skip to content

Instantly share code, notes, and snippets.

@Borodin-Atamanov
Borodin-Atamanov / root-inotify-wait.sh
Last active October 6, 2022 02:34
How to watch file modifications in Linux
echo 16777216 > /proc/sys/fs/inotify/max_user_watches;
echo "@/dev/" > '/dev/shm/inotify.stop';
echo "@/sys/" >> '/dev/shm/inotify.stop';
echo "@/run/" >> '/dev/shm/inotify.stop';
echo "@/home/i/.cache/chromium/" >> '/dev/shm/inotify.stop';
echo "@/home/i/.config/chromium/" >> '/dev/shm/inotify.stop';
inotifywait --monitor -e create,modify,move,delete \
--format '%w%f' --recursive / --fromfile '/dev/shm/inotify.stop' \
| tee /dev/shm/inoty.txt; \
cat /dev/shm/inoty.txt | sort -u > /dev/shm/uni-inoty.txt