Most users are probably familiar with a GUI-based word processing program. For example, I am using LibreOffice Writer to compose this book. However, you can edit files using the command line as well. Some of us even prefer it.
It is assumed the reader has access to a Linux machine with a selection of text editors available. We will start with vim, a text editor that is available on every Linux/Unix system. If Emacs is not on your system, try installing it with yum install emacs
or apt-get install emacs
.
The following is the method to create and edit a text file using the vi
command:
Let's go to the
tmp
directory. Run the following command:cd /tmp
Now run:
vim lbookfile1.txt
Your terminal should have cleared with vim running in it. Vim is modeless, and so always has to be told what mode to be in. Press the A key.
Vim should now be in Insert mode. You may see something like
-- INSERT --
at the bottom of the screen. Now type...