12

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
  • 2
    & with an empty pattern should work. What version of less do you have? Have you checked man less?
    – jw013
    Commented Jun 3, 2014 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
    Commented Jun 3, 2014 at 19:23

1 Answer 1

10

Just enter & again with no search term

2
  • Does not work if the previous search didn't return any lines.
    – Tom-db
    Commented Jul 27, 2017 at 8:08
  • 2
    @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
    Commented Dec 20, 2018 at 6:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .