I'm using the command:
tail -f -n 0 file.txt
But it keeps repeating itself.
What I'm doing is the following:
Create the file in the first terminal:
touch file.txt
Start the tail in the second terminal:
tail -f -n 0 file.txt
Edit the file in the first terminal:
nano file.txt
Just add
text
, save and close. The second terminal outputstext
like it should.Edit the file again in the first terminal:
nano file.txt
Add in the end (2nd line)
more text
, save and close. The second terminal outputs:
tail: file.txt: file truncated
text
more text
Edit the file again in the first terminal: nano file.txt
Add in the end (3rd line) even more text
, save and close. The second terminal outputs even more text
like it should.
Edit the file again in the first terminal: nano file.txt
Add in the end (4th line) and even more text
, save and close. The second terminal outputs:
tail: file.txt: file truncated
text
more text
even more text
and even more text
I need the command to not repeat itself.
The output resulted in:
tail -f -n 0 file.txt
text
tail: file.txt: file truncated
text
more text
even more text
tail: file.txt: file truncated
text
more text
even more text
and even more text
And I need it to output:
tail -f -n 0 file.txt
text
more text
even more text
and even more text
Or, if it's not possible to remove the "file truncated" message, something like:
tail -f -n 0 file.txt
text
tail: file.txt: file truncated
more text
even more text
tail: file.txt: file truncated
and even more text
I also don't know why it gives the file truncated message. I start inserting the new text at the end of the file.