Nano
Translations of this material:
- into Russian: Nano. Translation complete.
-
Submitted for translation by MaxPv 27.10.2009
Published 2 years, 6 months ago.
Text
Nano is a simple editor. To open it and begin creating a new text file, type the following at the command line:
$ nano
Instead of a few lines of output, as you get with most commands in this book, the screen is taken over by the program as shown in Figure 1.
nano_openfile
The screen is no longer a place to execute commands; it has become a text editor. Since we typed nano by itself, we have the text editor open with a new (blank) file. We could also open an existing file by typing something like:
$ nano textfile.txt
The text from the file is now displayed within nano.
Exiting nano
To exit nano, hold down the Ctrl key and press the x key (a combination we call CTRL-X in this book). If you have created some text but have not yet saved it, nano will ask:
$ Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
To save the changes, just type y. To abandon your changes, type n.
If you haven't typed anything into a new file, you have nothing to save so nano will just exit without saying anything.
To save changes without exiting, press Ctrl-o. Nano will ask you for the filename in which to save the text:
$ File Name to Write:
Type the name of the file, and press the Enter key. For instance:
$ File Name to Write: textfile.txt
Exploring Files
You can move around the file and view different parts using the arrow keys. This is a very fast and responsive way to explore a file.
