1

How can I make less show the previous couple of lines when I search for something? I'd like to get rid of the kkk steps in my usual process:

  • /keyword
  • kkk
  • (read)
  • n
  • kkk
  • (read)
3
$ less -j 4 file

That will put the pattern you searched for on line 4 of the terminal.

To save typing this every time, you can put LESS=j4 into your environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy