Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In the documentation for logstash, they mention the command tail -0a

I have never heard of the -a flag and I can't find any information on google, tail --help or the man pages.

What is the difference between tail -0a foo.bar and tail foo.bar


After testing this further, I wonder if it is a typo. Neither command works on my mac.

[root@interactive adaptive]# tail -0a /var/log/messages
tail: option used in invalid context -- 0

[root@interactive adaptive]# tail -a0 /var/log/messages
tail: invalid option -- 'a'
share|improve this question
Came here because this site mentioned "tail -0a": logstash.net/docs/1.4.2/tutorials/getting-started-with-logstash –  antak Sep 12 '14 at 1:48

2 Answers 2

up vote 4 down vote accepted

tail -0 is a historical, deprecated way of writing tail -n 0, i.e. print the last 0 lines of the file. (So tail -0 doesn't produce any output.)

I don't know of any tail implementation that has a -a option. From context, it looks like -f was meant. tail -f makes tail keep the file open when it reaches the end, and keep watching forever in case some other program appends more data at the end of the file, and prints this appended data as it comes. So tail -0f starts at the current end of the file, and prints any data that is subsequently appended to the file.

share|improve this answer
@Giles So what will happen if tail -f -n 0 combination is used? Suppose that the file is growing continuously. –  Geek May 19 at 5:58
@Geek It starts at the current end of the file, and prints any data that is subsequently appended to the file. –  Gilles May 19 at 9:33
@Giles one more follow up question. So if I had used tail -n 5 -f file then as the file grows it always shows the last 5 lines right? Then going by that analogy tail -n 0 -f file should never output anything at all even if the files grows after starting the tail command. What am I missing? –  Geek May 19 at 10:05
@Geek No. With tail -n 5 -f, first the last 5 lines are displayed, then everything that's appended to the file. tail is not a viewer that refreshes to show the last N lines of the file, it's a filter that removes the beginning of the file. Once it's printed something out, it can't take it back. –  Gilles May 19 at 10:42

The -0 means 0 lines, in other words, don't print any existing stuff.

None of the tail man pages mention a -a option. Perhaps they meant -f or -F, which would print any new contents written after tail started.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.