O'Reilly logo

Linux® For Dummies®, 8th Edition by Richard Blum, Dee-Ann LeBlanc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Editing Text Files with nano

If you aren’t using (or can’t use) the GUI, you have numerous text editors available to you. The most powerful of these are vi and emacs, which you’ll hear many people go on about. However, both these programs require a learning curve. For beginners who want to just edit the dang file and move on, I recommend nano, which offers a friendly, menu-driven interface.

To open a file in nano, type nano filename, such as nano file1. This action opens the file in the nano editor, as shown in Figure 11-1.

Figure 11-1. The file file1 open in the nano editor in Fedora Core.

You can then edit or type in that file as much as you need to.

Saving your work as you go

To save your file’s contents without closing it (so that you can keep working on it):

1.
Press Ctrl+O to Write Out. A prompt appears toward the bottom of the screen, asking for the name of the file and offering the current name as the default option.
2.
If you want to use the same name, press Enter. If you want to change the name, make your changes and then press Enter. The lower part of your screen now displays that it wrote (saved) a certain number of lines.
3.
Get back to work!

Saving and moving on with your life

To save your file’s contents and close it (because you’re done working on it for now) — or to close the file and not save the changes — do the following:

1.
Press ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required