← more articles

Nano (Simple Text Editor)

GNU Nano is a simple text editor for text terminals - easy to use (until you master VI or Emacs).

Older versions of nano are readily availble in most unix environments.

  • Ubuntu/Debian: sudo apt-get -y install nano
  • RedHat/CentOS/Fedora: sudo yum install nano
  • Mac OS X: nano is installed by default.

Nano Usage Tips

  1. CTRL-T - Spell check
  2. CTRL-J - re-justify text (when using mdnano, justifies to 78 characters)
  3. CTRL-K - Cut lines (e.g. kill)
  4. CTRL-U - Paste lines (e.g. UnCut)
  5. ALT-U - Undo (in newer versions)

Further information: Text Editing Made Easy.

Nano installation Instructions

Follow the instructions below to install a recent version of nano with syntax-highlighting, and special settings for easy MarkDown editing.

Installation

Download nano:

wget http://www.nano-editor.org/dist/v2.4/nano-2.4.2.tar.gz
# Use curl if wget not available
# curl http://www.nano-editor.org/dist/v2.4/nano-2.4.2.tar.gz > nano-2.4.2.tar.gz

Build & Install nano

tar -xzf nano-2.4.2.tar.gz
cd nano-2.4.2
./configure
make
sudo make install

Download and install markdown syntax highlighting:

wget http://crashcourse.housegordon.org/files/markdown.nanorc
# Use curl if wget not availalbe:
# curl http://crashcourse.housegordon.org/files/markdown.nanorc > markdown.nanorc
sudo cp markdown.nanorc /usr/local/share/nano/

Download and install nanorc file:

wget http://housegordon.org/files/nanorc
# Use curl if wget not availalbe:
# curl http://crashcourse.housegordon.org/files/nanorc > nanorc
sudo cp nanorc /usr/local/etc/

Create alias for Markdown editing with nano (optional):

echo "alias mdnano='nano -E -T 4 -Y markdown -r 78'" >> ~/.bash_aliases
. ~/.bash_aliases

Install spell-checker (optional)

sudo apt-get -y install spell aspell

NOTES

  1. Above instructions assume defaults settings:
    configuration files in /usr/local/etc
    binary files in /usr/local/bin
    data files in /usr/local/share/nano
    These could be changed with custom parameters to ./configure.

  2. Above instructions assume the common ‘bash’ shell.

  3. Spell-check installation assume Debian/Ubuntu system.

← more articles