Terminal Text Editors
Introduction
There are many different text editors in Linux, the most popular are, nano, vi, and vim.
to edit a file using any of these tools, type the tool name followed by the file name (i.e.
nano <File Name>)
Nano
Nano is easy to use but has fewer features than Vi and also isn't installed by default.
To move through lines use the arrow keys.
To execute commands use the Ctrl button (Represented by
^in Linux) followed by the letter for the command.

Vi
Installed by default on most Linux distributions.
Harder to use than Nano but has more features (Especially Vim)
There are 2 modes in Vi:
Insert: In Insert mode, you can enter text, use the Enter key to go to a new line, use the arrow keys to navigate text, and use vi as a free-form text editor.
Command: Command mode means you can use keyboard keys to navigate, delete, copy, paste, and do a number of other tasksβexcept entering text.
When Vi is started, it's in the command mode.
To go to the insert mode, press on the
ibutton.To go to the command mode from the insert mode press the
Esckey.This is a list of some of Vi's commands:
iβ Switch to Insert mode.Esc β Switch to Command mode.
:wβ Save and continue editing.:wqorZZβ Save and quit/exit vi.:q!β Quit vi and do not save changes.yyβ Yank (copy) a line of text.pβ Paste a line of yanked text below the current line.oβ Open a new line under the current line.Oβ Open a new line above the current line.Aβ Append to the end of the line.aβ Append after the cursorβs current position.Iβ Insert text at the beginning of the current line.bβ Go to the beginning of the word.eβ Go to the end of the word.xβ Delete a single character.ddβ Delete an entire line.Xddβ Delete X number of lines.Xyyβ Yank X number of lines.Gβ Go to the last line in a file.XGβ Go to line X in a file.ggβ Go to the first line in a file.:numβ Display the current lineβs line number.hβ Move left one character.jβ Move down one line.kβ Move up one line.lβ Move right one character.
Last updated