1

less +F is a great command for watching logs, but it has very annoying issue. After a while it stops updating log file and requires restart. Is there any way to make it follow file forever?

3

It seems that less --follow-name reloads file after changes.

  • less +F --follow-name, this does the trick. Thanks. – WesternGun Apr 24 '18 at 14:23
1

I guess "less" does not stop arbitrarily, but because less keeps reading the filedescriptor of the file opened at start. But then the logfile is switched; it is renamed or deleted, and a new file with the same name is created receiving the log. However "less" just keeps reading the old file, and nothing is appended anymore.

What you want in that case is:

 tail -F file.log

you can use the scrollbuffer of the terminal emulator as a limited scrollback.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.