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?

10 Answers 10


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.

| improve this answer | |
  • 3
    Ctrl-b works, but b (by itself) also does. – Paused until further notice. 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
  • 2
    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
  • 6
    in fact, ? = shift + /, / is to search forwards. – HongboZhu May 23 '16 at 13:11
  • 1
    In fact Shift + G goes to the bottom of the file – Alex78191 Jun 6 '18 at 21:57

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

tac filename | less
| improve this answer | |
  • 1
    That's mostly a linux / gnuism... – chris Jun 16 '10 at 13:58
  • 60
    Fun fact: tac is cat backwards – dKen Mar 21 '16 at 15:57
  • 7
    This was my childhood cat's name. I don't think I realized why until now. – vaughan Nov 26 '17 at 12:46
  • Anybody heard of anything like ztac for gzipped files (ie zcat but backwards)? – irbanana Dec 4 '18 at 23:16
  • 1
    @irbanana: One way. But it doesn't save any time on large files because the whole file has to be decompressed. – Paused until further notice. Dec 4 '18 at 23:47


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.

| improve this answer | |
  • 6
    This not only goes to the end of the file, it waits for additional output at the end, like tail -f. If this isn't what you want, you should use +G instead. – Michael Hampton Aug 1 '18 at 18:31
  • you're right @MichaelHampton – Ruben Estrada Aug 1 '18 at 18:49
  • and you can stop waiting for additional output by pressing CTRL+C. It stops waiting for new data but does not exit less. – xdevs23 Nov 7 '19 at 22:01

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

| 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?

| improve this answer | |
  • Using tail (GNU coreutils) 8.13 on Ubuntu 12.02 here. No such option as -r. – JHH Mar 30 '16 at 6:47
  • I think tail -r is a BSD/macOS thing - those environments don't have tac. – fzzfzzfzz Apr 27 '17 at 15:24

I'm surprised nobody brought this up before, but:

?pattern searches for pattern backwards.

N finds the previous match of the pattern (that is, searching backwards).

For reference, /pattern searches for pattern forward and n finds the next match of the pattern. That's the way the search is commonly used.

| improve this answer | |

While using more or journalctl -xe using space bar takes you 1 page down. That worked for me. Hope this helps.

| improve this answer | |

Another alternative, after you have started less on a file:

alt + "end-key"

With "end-key" I mean the key that is usually located below the "home-key" on a keyboard.

| 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 =)

| improve this answer | |
  • I don't need cat with grep -- grep $StRING $FILENAME | less – Lee Gee Nov 10 '16 at 8:55
  • Imho, that's an absolutely different question. – Yaroslav Nikitenko Mar 23 '17 at 7:57

Perhaps some people did not understood what dr01 meant. I try to put it in other words.

  • Open the file in less
  • Forward search: Enter the key /
  • Backward search: Enter the key ?
  • For both of the preceding: Enter your search term now
  • Press enter
  • Press n to search for the next finding
  • Press N to search for the previous finding
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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