Is there a way to search, while I'm typing in
less? Just like the vim option,
As I didn't find a proper way to do it, is there any similar tool that can do it?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You can do a search from the command line:
less -ppattern filename
Or, once inside
/ followed by your pattern to do interactive searching (forwards).
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