How to Search in Nano Text Editor in Linux

Nano is a popular text editor in Linux that offers many useful features. Sometimes you may need to search for a text in nano editor. In this article, we will look at how to search in Nano text editor in Linux. You can use these keyboard shortcuts in almost every Linux distribution, since nano is already present in most Linux flavors by default.


How to Search in Nano Text Editor in Linux

It is very easy to search text in Nano editor.

Press Ctrl+W or F6 to get search console. Enter the search term and hit enter to get to the first result. Enter Alt+W to continue searching.

Hit Alt+B to search backwards.

Press Ctrl+C to cancel any time and exit the search.

Also read : How to Copy File to Multiple Directories in Linux


How to Search and Replace in Nano

Here are the steps to search and replace text in Nano.

  1. Press Ctrl + \
  2. Enter your search string (e.g test) and hit return.
  3. Enter your replacement string and hit return.
  4. Press Y to replace next occurence, Pres A to replace all instances of your search term.

If your search term contains whitespace characters like space, tab, etc then enter verbatim mode first (Alt+Shift+V). Once you are in verbatim mode, then do as above. It will take in all the strings you enter literally.

Also read : How to Search in VI Editor