Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to search, while I'm typing in less? Just like the vim option, set incsearch.

As I didn't find a proper way to do it, is there any similar tool that can do it?

share|improve this question
Why Don't you use vim as your pager!? – user1146332 Sep 18 '12 at 15:36
@user1146332 hmm, I don't know if VIM could handle a stream directly, but seems ire_and_curses has given the right way to use vim – warl0ck Sep 18 '12 at 15:48
With '--' as command line argument vim reads from stdin (posted from mobile phone) – user1146332 Sep 18 '12 at 16:07
up vote 8 down vote accepted

You can do a search from the command line:

less -ppattern filename

Or, once inside less, use / followed by your pattern to do interactive searching (forwards). n and N repeat the search in the forward and reverse direction, respectively. That's the bare minimum you need to know; there are many more commands for more complex or specific searches.

Edit: To respond to your updated question, there's currently no way to do immediate incremental searching with less. Have you considered using view instead (opens Vim in read-only mode, so will use your incsearch setting)? Vim can be made even more pager-like with the vimpager script.

Some additional information: There is an open bug on the Ubuntu bug-tracker for incremental search support, but it doesn't look like it's going anywhere soon. Somebody has implemented incremental support on a github fork, but obviously you're going to have to compile a custom less to use that.

(And apart from the Ubuntu enhancement request there is currently (as of 2016-05-17) no such enhancement request on the official less bugtracker.)

share|improve this answer
Sorry, but the initial question i posted wasn't clear, can you check my updated question? – warl0ck Sep 18 '12 at 15:13
+1 Great answer – César Sep 18 '12 at 15:42
+1 for recommending view (read-only vi) - i hate it when people use vi instead of less or view, and lock the file unnecessarily. – cas Sep 18 '12 at 23:09

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.