How to search within less?

0103

To search within a file using the less command, follow these steps:

  1. Open the file with less:

    less filename.txt
  2. To search for a specific term, type / followed by the search term and press Enter. For example, to search for "ERROR":

    /ERROR
  3. To navigate to the next occurrence of the search term, press n.

  4. To navigate to the previous occurrence, press N.

  5. If you want to perform a case-insensitive search, you can start less with the -i option:

    less -i filename.txt
  6. When you're done searching, press q to exit less.

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

0 Comments

no data
Be the first to share your comment!