No, tail -f
does not always use inotify
.
inotify
not always available. Even if your kernel supports it, only a limited number of handles are available for viewing files using inotify, and they can be used elsewhere. Moreover, if any file in the list of names passed to tail
is not in the local file system, the poll will be used unconditionally.
The clever thing to do here is to trust the supporting devices to set up default behavior that should be appropriately configured for a reasonable balance of efficiency and performance and avoid the second assumption. This is doubly since then (without clearly defined semantics around behavior with -s 0
), any advice we have given here may be outdated in future releases.
Regardless: if your system really supports inotify, you will see a lower latency than the standard default polling period, which will be offered ready-made, without the need for settings or without default parameters.
See the actual delay loop used for tail -f
with inotify is available ; you will see that the time elapsed with -s
is indicated as a timeout for calling select (), but this timeout is reached only if inotify does not return any events to this point.
source share