Welcome back to Linuxables, where Linux.com makes you very “able” to use Linux! We resume our series with my favorite text editor Nano. Nano is an ncurses-based editor (which means it must be run from a terminal window) that focuses on simplicity. Nano is a clone of the aging Pico text editor, the editor for the Pine email client that was very popular, back in the early ’90s, on UNIX and UNIX-like systems. Pine has now been replaced by Alpine and Pico by Nano, but some things haven’t changed — like the simplicity of editing with Nano.
Nano was first created in 1999 under the name “TIP” (a charming, recursive acronym that stands for “TIP Isn’t Pine”) by Chris Allagretta. Mr. Allagretta decided to create this clone of Pico because Pico wasn’t released under the GPL. The name was officially changed on January 10, 2000 to alleviate confusion between the new editor and the tip
command (The tip
command is common in Sun Solaris).
Nano uses very simple key combinations in order to work with files. A file is either opened or started with the command:
nano FILENAME
Where FILENAME is the name of the file you want to open. Or, if you need to edit a file that only the root user has access to:
sudo nano FILENAME
When you have the file open in Nano you will notice, at the bottom of the terminal window, a short list of command key-combination examples. All key combinations for Nano start with the CTRL key. To execute a command you hold the CTRL (commonly referred to as the “Control Key”) key down and click the secondary key to perform the action. The most common key combinations for Nano are:
- CTRL-x – Exits the editor. If you are in the middle of editing a file the exit process will ask you if you want to save your work.
- CTRL-r – Read a file into your current working file. This enables you to add text from another file while working from within a new file.
- CTRL-c – Display the current cursor position.
- CTRL-k – Cut text.
- CTRL-u – Uncut (or Paste) text.
- CTRL-o – Save file name and continue working.
- CTRL-t – check the spelling of your text.
- CTRL-w – Search your text.
- CTRL-a – Go to the beginning of your current working line.
- CTRL-e – Go to the end of the current working line.
- CTRL-g – Get help with Nano.
There are plenty more commands to use in Nano. To see the command listing use the Get help command.
Installation
Not all distributions will ship with Nano pre-installed. Ubuntu, for one, does. If your distribution does not have Nano installed, fear not, you will find it in the default repositories. To install this tool all you need to do is follow these steps:
- Open up your Add/Remove Software utility.
- Search for “nano” (no quotes).
- Mark Nano for installation.
- Click Apply to install.
That’s it! Nano will now be installed. All you have to do now is open up a terminal and start editing.
Fun fact
The recursive acronym is very common within the Linux community. Although originated back in the early, often romanticized, days of the computer hacker, this type of acronym is one that humorously refers to itself. You have more than likely come across the acronym GNU in your Linux travels. Did you know that GNU stands for GNU is Not UNIX? Recursive acronym. Other fun recursive acronyms are:
-
LAME: LAME ‘AIN’T an MP3 Encoder
-
JACK: JACK Audio Connection Kit
-
LINUX: Linux Is Not UNIX
-
WINE: Wine Is Not an Emulator
You will often find Linux developers trying to create names for their applications that include recursive acronyms.