Home > Articles > Other IT Certifications

  • Print
  • + Share This
This chapter is from the book

Searching in vi

Searching for text in Linux utilities typically follows a common convention. In the less, more, and vi commands, a forward slash followed by a search term/string searches forward in the file from the current cursor position or the top of the file, highlighting found strings. Initiating a backward search from the cursor position is done with a question mark followed by the string to search for, such as ?string.


Searches are performed only in Command mode, so remember to press the Esc key to get back there.

Finding the next occurrence (whether a forward or backward search) is usually accomplished by pressing the unshifted N key to search forward. You press Shift+N for a backward search.

  • + Share This
  • 🔖 Save To Your Account