Red Hat Bugzilla – Bug 216729
tail -Nf syntax doesn't work anymore with multiple files
Last modified: 2007-11-30 17:07:37 EST
Description of problem:
Not sure if this is a bug - may just be to deal with vague syntax, but to me, it
seems like it should work.
The following syntax used to work with tail:
tail -5f /www/logs/access_log /www/logs/error_log
now I get:
tail: invalid option -- 5
I can still do either:
tail -f /www/logs/access_log /www/logs/error_log
(to tail both log files)
tail -5f /www/logs/access_log
(works with just one file)
I'd think since the "-Nf" syntax works with one file, it should work
with multiple files as well (tailing 5 lines of each).
It does work if I do:
"tail -f --lines=5 /www/logs/access_log /www/logs/error_log"
Version-Release number of selected component (if applicable):
charlie-web1:$ rpm -qf `which tail`
charlie-web1:$ cat /etc/redhat-release
Red Hat Enterprise Linux Client release 4.91 (Tikanga)
Steps to Reproduce:
Thanks for the report. I can see how you'd think "tail -5f" should work for any
number of arguments >= 1, but using a "-5" option (rather than "-n 5") puts your
usage in GNU tail's "obsolete, maintain only bare minimum of support with
legacy" mode. And legacy versions of tail-with-f only ever worked with a single
(In reply to comment #1)
> And legacy versions of tail-with-f only ever worked with a single
Well it's always worked w/ RHEL3, and seems to also work with RHEL4 (see below).
That syntax also works fine on FreeBSD's "tail", and with the version of tail
distributed with Debian 3.1 (5.2.1-31). It seems very inconsistent that it now
works when there is one file as an argument, but not with multiple files.
I already updated the thing I had which called tail this way, so it's not a big
deal to me if you want to close this... it's just kind of irritating.
triton:$ tail -5f /www/logs/error_log /www/logs/access_log.1164153600
==> /www/logs/error_log <==
[ 5 more lines ]
==> /www/logs/access_log.1164153600 <==
[ 5 more lines ]
triton:$ rpm -qf `which tail`
triton:$ cat /etc/redhat-release
Red Hat Enterprise Linux WS release 3 (Taroon Update 8)
nahant64:$ sudo tail -5f /var/log/messages /var/log/mysqld.log
==> /var/log/messages <==
[ 5 lines ]
==> /var/log/mysqld.log <==
nahant64:$ rpm -qf `which tail`
nahant64:$ cat /etc/redhat-release
Red Hat Enterprise Linux WS release 4 (Nahant Update 4)
'tail -n5 -f' is what you want to use. The 'tail -5' syntax has been deprecated
for quite a while.