Nano is my text editor of choice on both the Linux and macOS platforms. How many times have you read my words saying, “open so-and-so configuration file in the nano editor, locate entry X and change it?” If that configuration file is a few short lines, you’d have no problem locating the entry in question. What if it’s 100+ or 1,000+ lines of options to comb through?
At that point, you’d spend way too much of your precious time searching for the entry in question. Fortunately, the nano editor includes a handy feature to make this task exponentially easier. Said feature is, you guessed it, a search tool. With this search tool you can quickly locate those entries, no matter how big the configuration file is.
How do you use the search feature? Let me show you.
SEE: Kubernetes security guide (free PDF) (TechRepublic)
Let’s demonstrate with the Samba configuration file. Open that file with the command:
sudo nano /etc/samba/smb.conf
Let’s say you’ve configured a share named Public and you want to edit it, but don’t want to have to scan through the file to find it. Instead, use the key combination Ctrl+w, which will open the Search field. Type Public and hit Enter. The nano cursor will land on the first entry that matches Public.
If that’s not the one you’re looking for, hit the Ctrl+w combination again and you’ll see the search field is still populated with Public. Hit Enter again and the cursor will move to the next instance.
However, if you know you’re looking for Public encased in brackets, type that instead and the Search field will take you directly to the specific entry, where you can start editing.
And that’s all there is to using the built-in search feature of the nano editor. Trust me when I say this will save you so much time–especially when trying to follow tutorials and you need to alter a configuration file, a container manifest, or piece of code that’s thousands of lines long. Enjoy your newfound efficiency.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.