OT: tail nuance

Allan Jude allanjude at freebsd.org
Wed Feb 4 01:17:33 UTC 2015


On 2015-02-03 18:44, Paul Halliday wrote:
> I figured someone here would likely know the answer to this one.
> 
> On freebsd if I do:
> 
> ~% mkdir dirA
> ~% tail -n0 -F dirA/afile.txt
> ~% echo test > dirA/afile.txt
> 
>>> test
> 
> ~% mv dirA dirB
> ~% rm dirB/afile.txt
> ~% mkdir dirA
> ~% echo test > dirA/afile.txt
> 
>>> test
> 
> Which is what I would expect to happen. When I do the same test on a
> linux box it doesn't report the last echo (or any other redirection to
> the file).
> 
> What am I missing?
> 
> Thanks!
> 

Linux's tail is not as featureful

-F is just an alias for -f, whereas on FreeBSD tail -F:

The -F option implies the -f option, but tail will also check to see if
the file being followed has been renamed or rotated.  The file is closed
and reopened when tail detects that the filename being read	from has a
new inode number.
If the file being followed does not (yet) exist or if it is removed,
tail will keep looking and will display the file from the beginning if
and when it is created.

Some history on the tail(1) command:

https://www.youtube.com/watch?feature=player_detailpage&v=vm1GJMp0QN4#t=2434

-- 
Allan Jude

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20150203/391f96d9/attachment.sig>


More information about the freebsd-hackers mailing list