14

I have a very big text log file of about 37MB.
Using cat file | more I can view the file contents one page at a time.

The problem is that this always starts from the top - the old entries.
How can I make it start from the bottom where the newer entries are then move up page by page?

Parto
  • 15,685

1 Answers1

22

Try the tac command, which reverses the input, line by line.

Alternatively, less is more. Start at the end of the file using +G:

less +G some-file

You might have to get used to pressing b (which jumps back a screen) instead of Space.

muru
  • 207,970
  • 1
    tac starts at the bottom but I can't get a way to go up a screen. less some-file +G doesn't seem to work. – Parto Feb 23 '15 at 06:04
  • @Parto go up a screen in what? As for +G, open the file in less, then press Shift-G. Does it go to the end of the file? – muru Feb 23 '15 at 06:11
  • @Parto apparently less doesn't follow the Vim convention of allowing commands after filenames even though it borrows key strokes from it. Try less +G some-file. – muru Feb 23 '15 at 06:15
  • less +G seems more natural when viewing command line history, for example. Something like this: alias h='history -999999 | less +G' – Ville Dec 11 '16 at 22:42