11

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?

16

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.

  • 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 6: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 6: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 6: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

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.