There are several ways to write and edit files.
The most commonly used text editors are vi
, emacs
and gedit
.
Gedit is a text editor with graphical user interface. To create a new file in the current folder just call gedit
with the name of the file:
gedit file.txt
When you are done, save the file (by pressing Ctrl+S or by selecting File › Save) and close Gedit.
Vi is a text editor with a command mode interface. See this article for a beginner’s guide.
To create a new file in the current folder just call vi
with the name of the file:
vi file.txt
Vi has several modes which are specified in the bottom part of screen.
When you just open the editor you cannot write on the file, because it is the command mode.
To start writing, press i, and you will notice that the status in the bottom of the screen changed to INSERT
.
Now you can paste the text by right-click with the mouse and paste, or by pressing SHIFT+Insert.
To go back to command mode press ESC.
To save, make sure you are in command mode and type:
:wq
To undo, press u when you are in command mode.