Server Fault is a question and answer site for system and network administrators. 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

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
up vote 69 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
less your file, then type 'h' => you get a nice per-operation manual. Very neat, no need for external guides or the manpage IMO. – Kharski Jan 21 '15 at 14:32
in fact, ? = shift + /, / is to search forwards. – HongboZhu May 23 at 13:11

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
Fun fact: tac is cat backwards – dKen Mar 21 at 15:57

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

share|improve this answer

If you're looking for something specific, this might do it:

cat yourfile.txt | grep "something specific" | less

I use it for searching log files. It's still in the 'wrong' order though, but much shorter.

After reading Dennis Williamson's answer, that's my new method =)

share|improve this answer

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?

share|improve this answer
Using tail (GNU coreutils) 8.13 on Ubuntu 12.02 here. No such option as -r. – JHH Mar 30 at 6:47

Your Answer


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.