Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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.

share|improve this answer
+1 perfect answer, that's just why this option was introduced. Note that --follow-name was introduced in less v415 ( ), released 15 Nov 2007. Thus old Linux installation may not have it. – sleske Apr 29 '11 at 8:55

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).

share|improve this answer
If this is the case, try tail --follow=name [filename] (which causes tail to periodically reopen the file in case it is renamed). See… – Randy Orrison Oct 8 '09 at 14:49
No, the logs are not rotating. It's the same file. – TREE Oct 8 '09 at 15:14

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

share|improve this answer
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

You must log in to answer this question.

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