When I monitor some log file with tail -F file.log, I can press enter to add some space between actual log lines and the new ones, for example:

some log 1
some log 2
some log 3

some log 4
some log 5

But when I monitor some file with less file.log, I cannot add such space when I press the enter key. How could I add this tail -F file.log behavior to less file.log?


I would not like to edit the log file, I just need to add some spacing on the output while I am reviewing them in realtime (while I run tests on the application). Whether the file is going to be edited or not is irrelevant.

I just would like to use less instead of tail because less is more feature rich as find in buffer, etc.

  • I would like to view a log file written in realtime, so opening in a editor is not option. That is why I use tail -F.
    – user
    Nov 11, 2021 at 17:50

1 Answer 1

mkfifo fifo
tail -F file.log >fifo &
./script.sh | less

with this script:


exec 3<fifo

while true; do
        IFS= read -r -u 3 line
        test -n "$line" && echo "$line"
        if read -t 1 dummyline; then
  • I think that with this both ./script.sh and less will compete on reading from the tty. Not good. Also, what will happen when the user presses Ctrl-C inside less (as when trying to get out of the F mode?
    – user313992
    Nov 11, 2021 at 20:55

You must log in to answer this question.

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