Text File Editor

For terminal text editing, Nano and Vim are two of the top choices.


After you open or create a file by typing a command such as nano, it will show you a recognizable user interface. The interface displays the text contained in the file, along with various actions you can perform along the bottom. All these actions can be done by pressing Ctrl + Key at the same time. Some key combinations are listed in the below table.

Key Combination


Ctrl + O

To write the current file to disk

Ctrl + X

Close the current file buffer / Exit from Nano

Ctrl + Y

Move to the previous screen

Ctrl + A

Move to the beginning of the current line

Ctrl + G

Display the help text

Ctrl + C

Display the position of the cursor

Ctrl + J

Justifies the current paragraph

For more options use the link point_right Nano commands


The vi text editor is the de facto standard Unix editor and is available on all Unix flavors. A vi session begins by invoking the vi command, with (or without) a filename. You will be presented with a full empty screen with each line beginning with a ~ (tilde).

The vi text editor has 2 modes.

  1. Insert mode - This allows you to insert text into the file. The i key on your keyboard is used to enter the insert mode.

  2. Command mode - This allows you to issue commands that are used to manipulate the file. For Example, Cut & Paste, Find & Replace, Esc, Save & quit, so on.

Some basic vi commands and their meanings are listed below.






Save and exit




Force quit without saving

view <myFile.txt> or vi -R <myFile.txt>

View an existing file in read-mode only

vi <myFile.txt>

Create a new file or modify an existing file

Now, try creating a new file with content using vi.

vi myFile.txt

On the blank screen, hit the i key on the keyboard to enter insert mode. Then copy and paste the first line of text below or you can begin by typing in any text you want.

I am trying out the vi text editor
-- INSERT --

Note that the last line shows that the user is actually in insert mode. This means that the editor is ready to receive input from you. When you’re done editing, hit the Esc key then save and exit the editor by using the command below.


For more details about the vi editor, please visit the link point_right Editing with VI


vim is somewhat similar to vi and is also known to be an improved version of the vi editor distributed with most UNIX systems. Just in case you are curious to know the difference between vi and vim, you can use the command below. Note that you enter the command after starting a vim session.

:help vi_diff
For more details about vim editor, please visit their official website vim.org and for more commands or Cheatsheet, use the following link point_right vim commands