Table of contents
Linux systems are largely servers. These servers are mostly made up of configuration files, that do not have a GUI. There will always be a need to configure or edit these configuration files. Text editors come in handy to do the job of both configuring and editing.
The two most popular text editors are vim
and nano
.
Vim Text Editor
Vim is a ubiquitous text editor for writing code. You navigate around the screen with the keyboard instead of your mouse. vim
is based on the Unix text editor vi
from 1976. vi
was improved to vim
. In my experience vim
is harder to navigate. I have gotten stuck so many times on the editor, the esc
did not save me. Despite this setback, vim
is Incredibly powerful!
Useful Vim commands
- To open run:
vim
- To view all commands, and it’s documentation run:
:help
- To exit without saving type:
:!q
- To create and open a file in the vim editor just write the file name after the vim command in the terminal as follows:
vim 90DaysOfDevOps.txt
- In
vim
you will have to get into insert mood to write in the editor. For insert mode click
i
You would need to leave insert mode to save and exit.
- To leave insert mode click on
esc
- To save and edit:
:wq!
You can use the cat
command to check if the changes have been saved.
Nano Text editor
Nano is a simple, modeless, WYSIWYG ( what you see is what you get) command-line text editor included in most Linux installations. A simple, easy-to-use interface makes it a great choice for Linux beginners. nano
- To create a new file and gain access to the text editor run:
nano 90daysofdevops
Edit or write whatever you want
Click on ctrl o then enter to save
Click on ctrl x to exit.
You can also use the
cat
command to check if whatever you wrote was properly saved.