Guide to Unix/Commands/File Editing
Unix and Unix-like operating system come with a multitude of terminal editors. An editor codified in POSIX is vi, widely available on Unix variants. A small selection of other terminal editors follows.
joe
editA plain-text editor with syntax-coloring support whose editing keys are based on MicroPro's word processor WordStar.
Links:
- joe man page, freebsd.org
- Joe's Own Editor, joe-editor.sourceforge.net
pico
editPico is an easy-to-learn text editor originally designed for composing e-mail in Pine.
Links:
- pico man page, freebsd.org
nano
editGNU nano is a clone of Pico. The license is GNU GPL V3[1]. 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.
A Windows version can be obtained from files.lhmouse.com[2]; the source code seems to be at github[3]. Windows version used to be hosted at SourceForge[4], up to a 2002 version 1.0.8.
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.
Links:
- 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
editA powerful editor based on ex. For details see the Wikibooks Learning the vi Editor.
Vim is a vi-compatible editor with more features.
Links:
- vi, opengroup.org
- vi man page, man.cat-v.org
- vi man page, freebsd.org
- Vim home page, vim.org
emacs
editA very powerful editor that is used by many programmers. See also Emacs.
Links:
- GNU Emacs Manuals Online, gnu.org
zile
editA light-weight, feature-reduced clone of Emacs.
Links:
- zile man page, freebsd.org
- GNU Zile, gnu.org
See also
editLinks
edit- Comparison of text editors, wikipedia.org
- List of text editors, wikipedia.org
- TextEditor, wiki.debian.org
- List of applications # Text editors, wiki.archlinux.org
- Text editor, wiki.gentoo.org
- Most Popular Developer Environments by Occupation in Stack Overflow Developer Survey 2017, stackoverflow.com
- Most Popular Development Environments in Stack Overflow Developer Survey 2019, stackoverflow.com
- Integrated development environment in Stack Overflow Developer Survey 2022, stackoverflow.co
- Top IDE index, pypl.github.io
- What text editors in terminal do you use and why?, quora.com