Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I sometimes have to look through files that are several gigs and have noticed that finding what I am looking for with grep is much faster than with less. Why could that be? I am talking about looking for a certain tag/word, not even any complicated regex.

share|improve this question
Not an answer, but have you considered using grep and then a pipe to pass the results onto less? –  ridogi Jan 12 '10 at 7:19
Yes, I usually use grep with -A/B/C to get some context around what I am searching for but sometimes I need more flexibility as I am looking at log files and need to be able to scroll around and incrementally search from there on/before –  naumcho Jan 12 '10 at 21:18

1 Answer 1

By default, 'less' calculates line numbers, which can slow it down. Try using the '-n' option to suppress line number calculations and see if that speeds things up.

share|improve this answer
I think the line counting happens once grep has found your match - then you see "Calculating line numbers" and it takes a while before it lets you do anything, but you can cancel that with ctrl+c. It doesn't look like the -n helps with the actual search speed. –  naumcho Jan 12 '10 at 21:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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