3

I'd like to output just the lines that are added to a file after the "tail" command is run. i.e. not output any lines that existed in the file before the "tail" command is executed. So far, a "tail -f" also outputs the law few lines of the file as soon as it invoked. I don't want this. Thanks!

1 Answer 1

5

You can use the -n flag for tail to tell it how many lines to display before following the output. You can simply set this to "0": tail -f -n 0 /path/to/file.

3
  • I already tried this. I found that it does not display any output at all, regardless of how much gets written to the file. I agree, that this command ought to work though.
    – Rebroad
    Dec 27, 2019 at 20:52
  • @Rebroad is this tail from GNU coreutils? I was going to answer exactly the same thing jordanm did before he got to it first, and this is the correct solution for the tail that comes in coreutils (which is to say, any variety of Linux). But if you're using bsd or some other tail, it may possibly behave differently.
    – Kefka
    Dec 27, 2019 at 20:55
  • @jordanm it appears you are right, the reason I was getting no output must be elsewhere.... thank you!
    – Rebroad
    Dec 27, 2019 at 21:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .