Live Chat!

Basic text search in less

0 votos Vota!!

November 2nd, 2006 toydi Posted in Common, less | Hits: 5921 |

We usually use less as the default pager to display manuals and text files. Besides its basic navigation commands (up, down, pageup, pagedown, home, end), its text search commands may come in handy as well.
Let say we view a file:

less /usr/share/games/fortunes/linux

To search a keyword e.g. Linus, we type:

/Linus

A few more buttons to press:

  • n - forward to the next found line.
  • N - back to the previous line.
  • ESC+u - turn off the highlights.

and of course, the q to quit, h for help and what else.. you have tips? ;-)

Leave a Reply

Security Code: