Text Editor Facts
The vi Editor
Initial mode is Command mode for executing commands.
Edit mode allows writing and modifying text.
Insert mode: adds text.
Replace mode: overwrites text.
Importance
Text editors are crucial for configuring Linux systems that lack a GUI.
The vim Editor
vi or vim is the primary command-line text editor for Linux distributions.
Vim stands for "Vi Improved" with extended functionalities.
vi and vim interfaces are similar, leading to interchangeable use of names.
Common vi Commands
Command | Function |
|---|---|
| Starts vi. |
| Opens a specific file (new or existing). |
| Enters insert mode. |
| Enters command mode. |
| Deletes text. |
| Jumps to a specific line in the document. |
| Cuts a word and trailing space. |
| Cuts a word omitting trailing space. |
| Cuts from cursor to end of line. |
| Cuts the entire line. |
| Paste text from memory. |
| Undo last action. |
Additional vi Commands
Command | Function |
|---|---|
| Opens a new line above. |
| Opens a new line below. |
| Displays file info (name, lines, cursor position). |
| Searches forward for a term. |
| Searches backward for a term. |
| Copies current line to memory. |
| Appends text after cursor. |
| Appends after the current line. |
| Changes text to end of line. |
| Changes entire line text. |
| Saves and exits vi. |
| Moves cursor left/down/up/right respectively. |
The nano Editor
Starts with
nanoat the shell prompt.More user-friendly compared to vi.
Nano Shortcuts
Shortcut | Function |
|---|---|
| Displays help text. |
| Exits nano. |
| Saves the current buffer to disk. |
| Goes back one word. |
| Goes forward one word. |
| Marks text from cursor. |
| Cuts line or marked region to cut buffer. |
| Pastes from cut buffer. |
Choosing a Text Editor
Availability: vi is in all distributions; nano in most.
Licensing: vi (BSD/ CDDL), nano (GNU GPL).
Interface Complexity: vi is less intuitive; nano is user-friendly.
Feature Set: vi is complex; nano is basic.
Learning Curve: vi has a steeper learning curve compared to nano.
Recommendation
For beginners: choose nano for simplicity.
For advanced features: use vi.