Skip to content

Nano text editor Installation on a CentOS server

Posted by Nathan Giesbrecht on February 19, 2012 in Web Server Administration, Linux, Snippets, Software, Tips

Why Use GNU Nano

ScreenshotVi is a very powerful text editor that comes installed with most versions of Linux. It’s also very overwhelming when you’re first learning it! That’s why I like to install Nano in whatever Linux environment I happen to be working in. To install Nano in CentOS 6.2, you’d type yum install nano into your console. By default it will install to the /bin directory.

Once installation is complete, you can freely edit your text files with Nano by typing nano filename.txt when your in the same directory as filename.txt. Alternatively, if you’re trying to edit a file in another directory, you could employ it with nano /path/to/filename.txt.

All operations are done with CTRL key combinations. For example to save the file, you simply hit CTRL+O (“O” stands for write-Out). To exit, simply hit CTRL+X (“X” stands for eXit). If you’ve forgotten to save your changes, Nano will be nice enough to ask you if you’d like to save the file before exiting. You can also open a file when the program is running with CTRL+R (“R” stands for “Read file”). Most of the frequently used commands are always displayed on screen as well. If you’re new to Linux, this should make text editing much easier.

Use Nano as default text editor

If you want to go a bit further, you can set up Nano as your default text editor in Linux. To do so, you simply need to add the following code to the .bashrc file in your home directory:
export EDITOR=/bin/nano

The next time you login, Nano will be your default text editor. So for example, when using Git you don’t need to remember how to save & exit with Vi any more. You’ll have all the commands you need to know displayed on your screen at all times.

You can visit the Official Nano Homepage here. If you don’t have YUM installed on your machine, you can download it here. It’s available in .RPM, .TAR.GZ, .ZIP, and in several binary formats for Linux, and even Windows.

Happy text editing! Please feel free to leave any tips you might have for other users in the comments.

About the Author

Nathan Giesbrecht is a web design and web development professional. Nathan likes Wordpress, the Winnipeg Jets, green tea, hot dogs and golf.

Spread The Love, Share Our Article

  • Delicious
  • Digg
  • Newsvine
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter

Related Posts

Comments

There are no comments on this entry.

Trackbacks

There are no trackbacks on this entry.

Add a Comment

Required

Required

Optional