To save as another file name, type in the new name and press Enter, or use the Ctrl-T key combination to use nano's built-in file browser.Ĭlose a file with the Ctrl-X key combination. When prompted, press enter to accept the existing file name. Save and Save As are both accomplished with the Write Out command, Ctrl-O. If a file is already open, nano will insert the new file into it at the current cursor location it will not close the existing file, nor will it open a new screen for the new file. When prompted, type the name of the file you want to open, or use the Ctrl-T key combination to use nano's built-in file browser to navigate to the file you want to open. The Read File command inserts a file from disk at the current cursor location. Open a file with the Read File command, Ctrl-R.
This section shows you how to open a file when nano is already started. You can open a file for editing when you start nano, as discussed in the Starting Nano section. See the Editing Text section for more information. They are listed in nano's online help, accessible with the Ctrl-G key combination.Ĭopy, paste, and cut operations are available, but they do not use the same Ctrl-key sequences as in most GUI editors. If you are at a keyboard that does not have these keys, you can use alternative Ctrl-key combinations. The Page Up and Page Down keys, the Arrow keys, and the Insert key and Delete key all work as in most other text editors. Typing at the keyboard will insert text at the current cursor location. The gpm package is in the Universe repository. If you are using nano at the system console, you must have gpm installed and running before using the mouse. Use the Alt-M key combination to toggle between using the terminal's mouse services and nano's built-in mouse services. They provide only the ability to move the cursor to the point where you click, and to mark the beginning and end of a section of text. Nano has its own built-in mouse services, but they are limited. For example, you cannot use the mouse to cut or delete text, nor can you use the mouse to scroll through the file. However, when you use the middle mouse button to paste text, the text is pasted at the current cursor location, not at the mouse pointer location. You can highlight text, right-click to copy and paste, and use the middle mouse button for pasting text from the buffer. The mouse works almost the same as in a GUI editor. The $ symbol is not part of your file it just tells you that the line of text is too long to be displayed in the terminal.īy default, mouse services are provided by the terminal window. Long lines that are not wrapped to fit the window are indicated by the $ symbol at the extreme right edge of the terminal window. And when you resize the terminal window, nano adjusts itself accordingly. The screen fonts and background colours are determined by your terminal settings. For example, use the Ctrl-G key combination to display a basic introduction to nano and its default screen layout. The ^ symbol represents the Control key on your keyboard. The bottom two lines show the key combinations for common operations. The default nano screen layout is as shown in Figure 1. The two main features that differ are the short-cut key combinations and the use of a mouse. Although not complicated or difficult to use, it is different than a GUI-based text editor such as gedit. Nano is a terminal-based command-line program.
If for some reason it's not, use your favorite package manager to install nano. Nano is part of the standard Ubuntu installation, and should be on your system already. If you want to learn more advanced techniques such as the use of multiple buffers or syntax highlighting of code, see the the nano project's documentation.
Nano can be used in a terminal window or at the system console.īasic use of nano is covered here. Pico is the terminal-based editor used in the Pine email suite from the University of Washington.
It was originally created as a free replacement for the non-free Pico editor. Nano is ideal for making small changes to existing configuration files or for writing short plain text files. Though not as powerful as Emacs or Vim, it is easy to learn and use. GNU nano is a simple terminal-based text editor.