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.
How to Search and Replace in Nano
Here are the steps to search and replace text in Nano.
- Press Ctrl + \
- Enter your search string (e.g test) and hit return.
- Enter your replacement string and hit return.
- 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