Linux · Server

Update the nano Text Editor on Ubuntu

In this entry I will guide you to update the standard terminal editor used by Ubuntu from its classic 2009 revision to its latest release.

GNU nano is the default terminal text editor for Ubuntu but is also used as a fallback editor in case your system fails. This might be one of the reasons why the default nano version is held back and why you may not want to apply this update.

nano -V

nano -V default

At the time of writing a visit to the official GNU nano homepage reveals the current stable nano version is 2.4.3 2.7. While most Ubuntu installs are running 2.2.6. So let’s update!

Compile and install

First we remove the existing nano package and install some dependencies that we will need to compile nano from source. If you’re curious the libmagic-dev package is used to auto-detect file types for nano’s syntax highlighting feature.

sudo apt-get build-dep nano
sudo apt-get install libmagic-dev

Now download the nano 2.7 source and extract it.

cd ~
tar -xf nano-2.7.0.tar.gz
cd nano-2.7.0

Run the configuration script, I apply the following compile option.

./configure --enable-utf8

–enable-utf8 turns on UTF-8 character encoding support which is in widespread use.

You can see a complete list of options available by using help.

./configure --help

Now compile and install nano. You will see a lot of debugging feedback that can safely be ignored.

sudo apt-get remove nano
sudo make install

make install sample

When it is done let’s test nano to make sure it installed correctly.

source ~/.bashrc
nano -V


Change the default settings

The nano install copies a sample settings file into the etc directory. We will duplicate this file to our home directory and apply our own custom settings.

cp ~/nano-2.7.0/doc/nanorc.sample ~/.nanorc
nano ~/.nanorc

Go through the .nanorc settings file and uncomment any features you want turned on. I personally enable.

set constantshow
set smooth
set titlecolor brightwhite,blue
set statuscolor brightwhite,green
set keycolor green
set functioncolor yellow
set include "/usr/local/share/nano/*.nanorc"

set constantshow implements a live cursor positioner.
set smooth
improves the scrolling smoothness.
set titlecolor, set statuscolor, set keycolor, set functioncolor applies colour to the nano user interface.
set include “/usr/local/share/nano/*.nanorc”
enables colourisation of code markup and syntax.

Save your settings by pressing CTRL and the letter o and you are done!gnu_nano_270


If you ever find yourself wanting to revert back to the original nano installed by Ubuntu, you can do the following removal.

apt-get autoremove nano

You may need to remove the default configuration that was installed by nano 2.4.2 as it contains invalid directory paths.

sudo rm /etc/nanorc

Then install classic nano.

sudo apt-get install nano
nano -V

2 thoughts on “Update the nano Text Editor on Ubuntu

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s