Categories: Ubuntu

How to search keyword in a file using nano editor on Linux

In this article, we will see how to search a keyword in a file using nano editor on Linux. Nano editor is one of the most widely and frequently used editor on Ubuntu or Debian based linux systems due to its simplicity. It provides simple to use interface where we can easily insert, edit and search. It displays all the shortcuts at the bottom of screen which makes it easy for users to use and avoid the possibility of searching shortcuts here and there or memorizing it. Since nano editor comes as a default editor in many linux distributions, this saves you from installing this editor package separately. More on official

Sponsored
website.

It also saves us from learning shortcuts and commands of other complex editors such as Vi and Emacs. It is super user friendly especially for beginners and quite fast in performing various editor operations in comparison to other heavy editors. While inserting and editing in a file using nano editor is straight forward, sometimes searching can be little tricky. So here I am going to explain how you can search a keyword in any file using nano editor and then edit it and finally save all the changes and exit.

 

How to search keyword in a file using nano editor on Linux

Also Read: How to Install lighttpd web server on Ubuntu 22.04

To demonstrate the search, we are going to take an example of Kong configuration file kong.conf where we will search keyword admin_gui_path and admin_gui_url and update the same. First, open the configuration file using nano editor as shown below.

Ubuntu-Server@ubuntu:~$ sudo nano /etc/kong/kong.conf

You should see something like below:-

Now Press Ctrl+W to initiate a search. You should see a search prompt appearing at the bottom of your screen.

At the prompt, type admin_gui_path and click on Enter to initiate a search.

You will find the first occurrence of the matched keyword as shown below.

Sponsored

If you are looking for another occurrence of same keyword then you have to again search by pressing Ctrl+W. It will take you to the next occurrence of matched keyword and so on.

After finding the keyword, if you would like you can edit it and do the necessary changes as shown below.

Similarly, if you want to search another keyword and edit it then you can do that by again pressing Ctrl+W and searching that specific keyword. For example, we are now searching admin_gui_url keyword as shown below.

It should be located as shown below.

Like before, you can edit this as well before finally saving all the changes and exiting editor.

Once done, press Ctrl+X to save and exit. Press Y to confirm. You are now done !!

Ubuntu Server Admin

Recent Posts

From sales development to renewals: Mariam Tawakol’s career progression at Canonical

Career progression doesn’t follow a single path – and at Canonical, we embrace that. Our…

10 hours ago

In pursuit of quality: UX for documentation authors

Canonical’s Platform Engineering team has been hard at work crafting documentation in Rockcraft and Charmcraft…

10 hours ago

Ubuntu 24.10 (Oracular Oriole) reached End of Life on 10th July 2025

This is a follow-up to the End of Life warning sent earlier to confirm that…

1 day ago

Canonical announces Charmed Feast: A production-grade feature store for your open source MLOps stack

July 10, 2025: Today, Canonical announced the release of Charmed Feast, an enterprise solution for…

1 day ago

Ubuntu Adding NVIDIA 575 Driver Support for 24.04 & 22.04 LTS

For NVIDIA users, the latest 575 series driver will be available soon in Ubuntu repository.…

2 days ago

Amarok Released 3.3 with Qt6/KF6 Port & GStreamer Backend

Amarok, the free open-source KDE music player, released new 3.3 version on Tuesday, named “Far…

2 days ago