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?

1 Answer 1

21

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.

4
  • 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, 2015 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, 2015 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, 2015 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, 2016 at 22:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .