Using the less command on linux in tail mode (F command or less -f) consistently stops working on certain machines and/or certain files. New changes simply stop showing up.

I know I've fixed this before, long ago, but I don't recall what the solution was.

Any ideas?

  • Have you tried using strace to see what it's (not) doing? Maybe you'll see an error. – wfaulk Oct 8 '09 at 15:39
  • FYI, this remains unanswered because the file in question was not being rolled/rotated/recreated. – TREE Apr 26 '12 at 14:17

Try using less --follow-name. Even if the file has the same name, the process(es) updating it may be doing so in a way which changes the file's inode -- so from the OS point of view, it's a new file after the updates.

  • 1
    +1 perfect answer, that's just why this option was introduced. Note that --follow-name was introduced in less v415 (greenwoodsoftware.com/less/news.415.html ), released 15 Nov 2007. Thus old Linux installation may not have it. – sleske Apr 29 '11 at 8:55
  • This should only be an answer if the file is being rolled/rotated/recreated FWIW... – rogerdpack Apr 7 at 17:46

Are you viewing log files that are rotated by logrotate? If the file that less is viewing is renamed (e.g. from log to log.0 by logrotate), less will continue to watch that file, even though new entries are being written to a different file (with the original name).


maybe you could try tail -f [filename] instead?

  • 4
    With less, you can "pause your tail" (by using Ctrl-c) to go up to a specific line and resume later (using F). That's why in some cases it is preferred over "tail -f". – dogbane Oct 8 '09 at 15:06
  • tail -f does work, but I'd prefer to work within less. – TREE Oct 8 '09 at 15:14
  • I see. Did not know that. – brandstaetter Oct 8 '09 at 15:22

I do less +F --follow-name. --follow-name just monitors the file with same name without receiving the incoming changes in my case(CentOS 7).

Actually I create an alias for this:

Add this line in /etc/profile.d/alias.sh:

alias lf="less +F --follow-name"

Save, and source it to use it now. . /etc/profile.d/alias.sh

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.