All configuration files in Linux are written in plain English, easy to read and to adapt. We use a text-editor to write or make changes to those files.
The two most popular, powerful and “difficult” editors that you will find in every distro are Vi and Emacs. They both have “syntax-highlighting” to make writing code easy.
NOTE: Vi and Emacs fans fight bitter religious wars over which is better.
( I prefer Vi )
There are hundreds of commands for Vi, we will only touch the absolute minimum.
$ vi tessst
Will open the file tessst in located in your /home, if the file does not exist it will create one.
Vi has 3 modes: a command mode, an insert mode and an ex mode.
When you start Vi it starts in command mode. So we first have to type an "i" to put it in insert mode. Now you can type “the quick brown fox etc.”
After inserting the text we go back to command mode < Esc > and save the file with ZZ. Thats all we have to know for the beginning.: "i" for insert < Esc > for command, ZZ for saving the file.
Some more commands for Vi: ( less important )
i = insert text before the cursor
a = insert text after the cursor
: = switch to ex mode
$ = go to last place on the line
^ = go to first place on the line
w = next word
b = previous word
G = last line of the file
20G = go to line no 20
y = copy ( y3w = copy 3 words ) ( y3j = copy 4 lines )
p = paste
d = cut
x = delete character under the cursor
Emacs is made easy because these days it has a GUI in modern distro's, but we will use the keyboard because it has more speed.
$ emacs ssset
Will open or create the file ssset in your /home
OK type away: “ the quick brown etc”.
Now to save the file do: Ctrl+x, Ctrl+c, y
Well I said we were going to keep it simple !
Leave the tessst and ssset files in your /home, in the next section we can do some exercises with them.