After using a search in less of the format &pattern, which displays only matching lines, how can I go back to displaying all lines in the file?

Esc doesn't do anything as far as I can tell. Ctrl+c doesn't either. q simply exits less.

  • 2
    & with an empty pattern should work. What version of less do you have? Have you checked man less? – jw013 Jun 3 '14 at 19:01
  • I was using the built-in help for less, and now I see how easily I could've found it in the man page. Lesson learned. Version 436. – Rey Jun 3 '14 at 19:23

Just enter & again with no search term

| improve this answer | |
  • Does not work if the previous search didn't return any lines. – Tommaso Di Bucchianico Jul 27 '17 at 8:08
  • 1
    @TommasoDiBucchianico I think it works but you're left at the end of the file. You can e.g. hit 'Home' to see the lines. – YoungFrog Dec 20 '18 at 6:29

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.