Linux: write tail -f output, plus comments, to a separate text file
This does what you need:
sh -c 'tail -f file & cat' | tee file2
Note, it duplicates your comments for the terminal output when you press enter.
It works also with {...}
and (...)
instead of sh -c
, but then tail -f
won't stop running when you press ctrl+c.