4 ms·
A quick review of file watchers
- vincebowdren 2y agoListing 33 different file watcher programs for linux, with strengths and weaknesses
- fitsumbelay 2y ago`entr` is the homie
- kragen 2y agoWhat have you used it for? From Anarcat's notes, it sounds like it isn't very generally applicable.
- ndr 2y agoIt's great for running unit tests on save, or hacking on python script and re-execute them when you need. I often use something like this when iterating over stuff. This is a quick hack to list files I touched and differ from main. git diff main --name-only --relative | entr -r -c my-command This of course needs to be killed and re-run if you want to pick up new files
- kragen 2y agoThat's a great tip!
- simonmic 2y agoIt's great, but I switched to watchexec for its easier CLI. (But mac users, watch out for https://github.com/watchexec/watchexec/issues/864 https://github.com/watchexec/watchexec/issues/864, hopefully fixed soon.)
- gorbachev 2y agoFrom 2019
- kragen 2y agoThis is very timely! Linux still doesn't have a networked file watching protocol, does it? Like SGI fam, which gamin is based on. I understand SMB/CIFS supports this in the protocol, but Linux clients don't, and I don't remember if Samba does as a server. inotify is still an ugly and error-prone interface but it does basically work. What does the situation look like on other free OSes? A common related requirement is to access a given version of a file, for example so that you know it's consistent with itself. Linux does support so-called "reflinks" for this... but ext4 doesn't. Sad trombone.
- zero_shift 2y agoFun fact, chokidar is a Sanskrit word meaning watchman. It has an interesting root, it comes from the Proto Indo-European word for "four", because he must watch any enclosure of four walls. This ancient word is the source of the Latin "quartus" which comes into English as "quarter" The PIE sense is echoed a little in phrases like "living quarters", "give no quarters" etc
- laurent_du 2y agoI think you are overreaching a bit. The term 'quarter' in 'give no quarter' derives from the French 'quartier', which referred (in military jargon) to a section of a city or military encampment. Prisoners would be kept in 'quartier de sauveté' and 'donner quartier' is short for 'donner quartier de sauveté'. So I disagree that this is an echo of the PIE meaning. The most likely semantic development is that 'quartier', originally a quarter of something (the fourth part), came to denotate any fraction of a whole, and then was specialized in the military lexicon.
- zero_shift 2y agoWell, it's uncertain that "quarter" in this sense came from the Middle French. Early Modern English also uses "quarter" to mean "the relations between people", Shakespeare uses it for instance The actual link is obscure, but I don't think it matters too much - I'm observing a similarity, not attesting an origin.
- bjconlan 2y agoIt's a shame that fanotify[0] wasn't pointed out in this document also. Only since seeing it used in 'zigs --watch' impl on Linux[1] (and the fact that I need to enable admin capabilities to run this in a container) has informed me of it's existence. 0. https://docs.kernel.org/admin-guide/filesystem-monitoring.html https://docs.kernel.org/admin-guide/filesystem-monitoring.ht... 1. https://ziggit.dev/t/initial-implementation-of-zig-build-watch-just-landed-in-master-branch/5117/8 https://ziggit.dev/t/initial-implementation-of-zig-build-wat...
- deleted 2y ago[deleted]
- simonmic 2y agoA very useful list, thanks! I hope you'll keep updating it. I guessed the date(s) indicated the tool's approximate period of active development, but apparently not ? Eg watchexec says "2016-2019" but had a major release a few days ago. [Ah. Because this post is from 2019, and wasn't flagged as such on HN, and the list needs updating.]