I often have multiple terminal windows opened with less (eg comparing various log files). I forget which file is which. Is there a similar command to ^G in vi which displays the name of the file currently being viewed?
Asked
Active
Viewed 1.3k times
2 Answers
43
Compatible: ^G. Easy to type: =. Less copied several key bindings from vi, including this one. This displays the file name (the path that you passed on the less command line) and the position in the file.
You can have this information permanently by calling less with the -M option. Include -M in the LESS environment variable. You can set this variable in your ~/.profile, ~/.pam_environment or wherever you define environment variables. Alternatively, you can set LESS by using lesskey to produce the configuration file ~/.less which is read by less.
Gilles 'SO- stop being evil'
- 829,060
less +F -M <filename>it won't show the filename until you quit the follow. (+F=--follow-name) – phyatt Jan 13 '16 at 20:13lesskeyor about the-Moption! – Noah Sussman May 27 '16 at 07:07