Guide to Unix/Commands/File Editing
Basic editing of system files.
joe[edit | edit source]
A plain-text editor with syntax-coloring support whose editing keys are based on MicroPro's word processor WordStar.
pico[edit | edit source]
Pico is an easy-to-learn text editor originally designed for composing e-mail in Pine.
- pico man page, freebsd.org
nano[edit | edit source]
GNU nano is a clone of Pico. The license is GNU GPL V3. Nano runs in a console window. Some commands are invoked using Control + key combinations; other commands are invoked using Meta + key, where Meta includes pressing Alt simultaneously or pressing Esc before.
Warning: Some nano versions have hard line wrapping enabled by default. As a consequence, when you enter characters into a long line, nano automatically inserts a newline into it to limit its length. When inadvertent, this can cause trouble, especially when editing configuration files. You can disable the hard wrapping temporarily via Meta + L (Alt + L), or by running nano with -w option, or by placing "set nowrap" into .nanorc configuration file.
Help is available by pressing F1 or Control + G. You can search in the help by pressing slash (/); to find next occurrence, press N.
Keyboard shortcuts are listed in the help. Some of them are listed at the bottom two lines all the time unless hidden. Nano does not use the CUA keyboard shortcut convention familiar from some operating systems, so it does not use Control + C and Control + V for copying and for pasting. Keyboard shortcuts include the following:
- Control + X: Quit the editor, or if more than one buffer is opened, close the current buffer.
- Control + S: Save the current buffer without asking for a file name or confirmation unless there is no file name associated with the current buffer yet.
- Control + O: Save the current buffer, asking for confirmation of the file name even if the buffer already has a file name.
- Control + R: Insert the content of a file into the current buffer, or if so set via Alt + F, into a new buffer.
- Control + W: Search. After pressing the shortcut, options such as regex search can be enabled by further shortcuts appearing at the bottom.
- Alt + R: Search and replace. Regex option is available.
- Shift + arrow keys or home and end: Selects a region.
- Control + K: Cut the current selection, or if there is no selection, the current line. The cut text is placed into nano-internal cut buffer rather than to the system clipboard.
- Control + U: Paste what has been cut with Control + K, thus "uncut". Does not paste the system clipboard content, it seems.
- And more.
- nano man page, freebsd.org
- GNU nano: documentation, nano-editor.org
- nano source code, git.savannah.gnu.org
- GNU nano, wikipedia.org
- Useful Nano Keyboard Commands, staffwww.fullcoll.edu
- hard line wrapping should be disabled by default, savannah.gnu.org
vi[edit | edit source]
A powerful editor based on ex. For details see the Wikibooks Learning the vi Editor.
Vim is a vi-compatible editor with more features.
emacs[edit | edit source]
A very powerful editor that is used by many programmers. See also Emacs.
- GNU Emacs Manuals Online, gnu.org
zile[edit | edit source]
A light-weight, feature-reduced clone of Emacs.