nano aka GNU nano

I just realized that tomorrow (November 18, 2021) marks the 22nd anniversary of the release of nano.

I have been using nano for 21+ years. I remember when I first tried it and thought this is never going to catch on. I was familiar with vi, which was the most popular CLI text editor at the time, and every tutorial was written using vi as the CLI (command line interface) text editor. Over the years I began to use it consistently and it became one of the first applications that I would install every time I booted into a fresh install of any Linux distribution. It is standard in Ubuntu (and many others) today. It is so easy to use especially when you get the hang of the control interface.

I will demonstrate the use of nano to edit the nameservers on one of my machines, so you can see how easy it is to use. Let me know what you think in the comments.

You can also follow me on twitter:

https://platform.twitter.com/widgets.js
in this example I will edit my name server listed in /etc/resolv.conf file.
nano /etc/resolv.conf

Then you just press Enter/Return.

an open file in nano.

the interface is really easy to use, you can see all of your options at the bottom of the console, for example if you need to find a line (more for files with thousands of lines within it, this file only has 19 lines, and I can very clearly see the “nameserver” directive. however for your benifit I will demonstrate the Where Is comand by pressing CTRL + W.

CTRL+w will show you the “Search:” interface, and here you can see that I have typed “nameserver” and I will press Enter/Return.
as you can see the caret (aka text cursor) has moved to the line that contains “nameserver”.

Now that we are on the correct line, we will use the directional keys to move over to the start of the 1.1.1.1 IPv4 address representing the nameserver that is currently configured for this Ubuntu instance.

Now I will delete the content on that line, being careful not to pull the line below up onto the line that I am working with. This can be done by pressing the Del/Delete key (adjacent tot he End key on most keyboards) to remove the data.

Now I will enter the correct dns server using the numbers above the main keyboard (I have not figured out how to use the NumPad within nano) so that you do not trigger other commands.

Okay, now we have the correct nameserver in the correct position, I will save by pressing CTRL+X to exit.

You will see that I have now been prompted that there are unsaved changes that need to be written to the file. Simply press “y” to save the buffer to disk.

Here you are given an option to change the name and directory of the file, overwrite the original file by pressing Enter/Return.

All done. Now I’ll just check the identity of the server that is responding to my DNS queries, by using the following command in the CLI.

dig id.server TXT CH

Great. So the server that is responding is 1.0.0.1 on port 53 and it is showing it’s identity as YYZ (aka Toronto). In case you are not aware most networking engineers like to identify the locality of devices, routers, and servers; by using IATA (International Air Transport Association) airport codes.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: