In less / search for the next pattern and ? search for the previous pattern.

Is there any way to search pattern from the start of the file to the end? (I useually search forward and then backward but i wanted to know if there is more convenient way).


After reading the man less page, I found that /@ will search from the first line.

If multiple files are specified, it will search the first line of the first file.

  • /@ actually starts searching at the first line of the first file rather than the current file. It only makes a difference if you specify multiple files on the command line though. Still, very useful. Thanks! – virtex Dec 6 '16 at 17:18
  • Whoops! Fixing. – Nevin Williams Dec 6 '16 at 21:56
  • very helpfull! thx! – pio Dec 7 '16 at 12:04

I'm not aware of a way within less to always start searches at the beginning of a file, but you can always jump to the beginning of the file by pressing 1g then perform your search.

Your Answer

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

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