Find previous searches in less command
To browse less
search history (~/.lesshst
by default, man less
and LESSHISTFILE
for more):
less
a file, for exampleless ~/.lesshst
- type / or ? to search forward or backward or & to show only matching lines (/!, ?! or &! for non-matching)
- use up and down arrows ↑ and ↓ to browse the history, press Enter to choose one
- n repeats the search, N in reverse direction
Use /
to search forward.
Use ?
to search backward.
Use n
for the next occurrence of the search item and N
for prior occurrence. This works for both forward and backward searches.
And as pointed out in the comments if less history is enabled you can carry your search item across invocations of less.
man less
and man lesskey
for the details.