How to get less to seek faster with large log files?

Solution 1:

you can stop less from counting lines like this less -n

To jump to a specific place like say 50% in, less -n +50p /some/log This was instant for me on a 1.5GB log file.

Edit: For a specific byte offset: less -n +500000000P ./blah.log

Solution 2:

Less, being a pager, is inherently line-oriented. When you startup, if it's a large file it'll say "counting line numbers" and you hit ESC to stop that, but otherwise, it does lines. It's what it does.

If you want to jump straight into the middle of file and skip the beginning, you can always just seek past the beginning; I'd do something like tail -c +15000000 /some/log | less.



Log Files