How to search in less?

0209

To search in less, you can use the following commands:

  1. Search for a pattern:

    • Type / followed by the pattern you want to search for and press Enter. For example, to search for "ERROR", type /ERROR.
  2. Case-insensitive search:

    • Start less with the -i option to make searches case-insensitive:
      less -i filename
  3. Navigate through search results:

    • Press n to move to the next occurrence of the search term.
    • Press N to move to the previous occurrence.
  4. Exit search mode:

    • Press q to exit less and return to the terminal prompt.

These commands will allow you to efficiently find specific content within a file while using less.

0 Comments

no data
Be the first to share your comment!