How to read backward from the end of file in less or more?

I've found one way so far: less +G filename, but it's scroll up only with up key line by line. What's more powerful less usages which provide scrolling by page, pattern search backward and so on?


I'm sure someone else has a better answer, but

With "less" after you've opened the file:

G goes to the bottom of the file

^b goes up one page

? searches backwards.

As you said, you can open the file with +G and then use ? and ^b to scroll up. There are likely clever awk things you can do to achieve the same thing in a script.


For variety, if you actually want/need to read a file backwards (last line first):

tac filename | less

use:

less +F /path/to/your/file

that's less but starting from the bottom. Also, with +F, if the file is being written to while you are using less, that additional content gets output. This can be useful for logs.

Use the up arrow key to go backwards line by line or ctl+b to go page by page.


w goes up by page. ? does reverse search. h brings up online help.


tail -r | less

I don't know why anyone didn't think of this one. Tail grabs the end of a file really easy. Is -r not a common option?