When working with a terminal on Linux you will need to use a terminal text editor to make changes to config files. As the saying goes, Linux is just a bunch of configuration files. Depending on your needs, or your cli experience, it is best to use the text editor that fits you best. In this article we will go over the 3 most widely used text editors used on Linux: Nano, Vim and Emacs.
Nano
Nano is a simple text editor that is best used for quick line edits or for new Linux users. It displays it key mapping at the bottom which make it easy to save and quit out of. All functions use CTRL+”Key.” For example to exit you would just type CRTL+X. There is no insert mode so you can easily just start editing once you open a file. It is not much more then a simple text editor for the terminal. Think about it as the Notepad version of the Linux terminal. Nano will need to be installed on most Linux systems as it is not installed by default
Vim
Vim is for the more seasoned Linux user. It has multiple modes like insert mode to input text and command mode to run commands, use regex, and save/quit out of files. This is found installed already on most Linux systems which is why it is highly used by most system administrators. The reason it is used by system admins is because when using Linux for server applications you don’t want other applications installed on the server, so Vim in that case, is the go to solution for editing files since it does not need to be installed. Vim features multiple file/window support, keyboard shortcuts and makes use of macros (executing a sequence of instructions into a single output command). How do you exit out of Vim? A question for the ages.
Emacs
Emacs is the more robust of the 3 text editors. It is a text editor but it is also has a web browser, calculator, and IRC client. You can even play Tetris on Emacs. Like Nano it uses keyboard shortcuts. However, there are a lot more shortcuts and it can be hard to remember these short cuts. It uses CTRL+”Key/Keys” for these shortcuts. For example, CTRL+X then CTRL +C will exit Emacs. Since Emacs has so many different features it has a very high learning curve but knowing how to use all these features means you may never have to exit out of Emacs. You can do most of your work within Emacs. Emacs is not installed by default on most Linux systems.