Use "less" instead of "tail" for scrollback and search
You can use
tail -f error.log or, better:
tail -F error.log.
But if you want to scroll back in the file, that's not very useful.
less +F error.log
you get the function of
but can interrupt the reading of new input with Ctrl+C.
Then, you are in the normal
where you can scroll back to see what you may have missed with Up/Down
Also, you can read long log file lines without wrapping, using Left/Right
Search, and show only matching lines
You can also search for regular expressions with /, ? for backward, n and N for next/previous.
Very interesting for log files is that you can hide all non-matching lines for a search with &, filtering out only the matches.
Keys on command line
With F inside of
less, you continue the
tail -f-like mode.
+ in the command line
less +F means "press these keys directly after starting less".
So we used keypress F at startup, which is described as:
F Scroll forward, and keep trying to read when the end of file is
reached. Normally this command would be used when already at the
end of the file. It is a way to monitor the tail of a file which
is growing while it is being viewed. (The behavior is similar to
the "tail -f" command.)
multitail if you need to watch more than one log file.