How do I less a filename rather than an inode number?
Use less --follow-name
if your version of less
supports it. That option was introduced in version 416.
The less
option --follow-name
is only part of the solution;
To replace tail -F
, another argument is needed:
less --follow-name +F file.log
The option alone like less --follow-name file.log
does not actually start following the file updates. You need to enter the follow mode be pressing ShiftF.
(Exit the mode to navigate by ControlC.)
Instead of following the file, --follow-name
modifies the behaviour of less.
It makes the command key ShiftF inside of less
follow based on the file name, not the file descriptor.
Also, there is no normal option to start less
in follow mode.
But you can use the command line to give keystrokes to execute after startup, by prefixing them with +
.
Combining the modifier option with +F
, less
will actually start in the (modified) follow mode.
Use +F
alone for the equivalent of plain tail -f
:
less +F file.log