Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 16 down vote accepted

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.

share|improve this answer
    
Ctrl-b works, but b (by itself) also does. –  Dennis Williamson Jun 16 '10 at 13:31
    
Oops! I'm so conditioned to use vi keys that I just use those in less as well. Yes -- b moves you up a page in less, but only backwards one word at a time in vi. I'm impatient; I want a page at a time, and my walnut sized brain can't remember if I'm in vi or less sometimes... –  chris Jun 16 '10 at 14:06

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

tac filename | less
share|improve this answer
    
That's mostly a linux / gnuism... –  chris Jun 16 '10 at 13:58

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.