In the early days of Linux, and UNIX before it, the only choice for editing text files was using the terminal.
In those days, text editors were badass and mastering them put hair on your chest. The terminal based editors required a deep understanding of the terminal, how they worked, memorization of key combinations, and the ability to comprehend many modes of operation.
Thankfully, we’ve moved on. Graphical programs such as gedit, Geany, Sublime, and others greatly simplify the editing of text. You no longer need complex interactions to get the most out of your editor.
However, although it is possible to do so, you shouldn’t abandon terminal text editors. Despite the learning curve, a skilled user with a terminal text editor is faster than a master graphical editor user. And, not having access to a graphical user interface is common in the Linux world.
There are several terminal text editors, but we’re going to focus on the three most popular. We’re going to learn about their strengths and weaknesses. How easy they are to learn and how easy they are to use. And whether they like long walks on the beach or not.
nano: The Easy Choice
nano. It’s simple. It’s fast. It’s effective. Anyone capable of using the Linux terminal will master nano with little effort.
The strength of nano is how easy it is to learn. You don’t need to remember keyboard shortcuts; it tells you what they are. It doesn’t have complicated modes of operation; it just works as is.
The weakness of nano is its limited feature set. It’s simple, but not powerful.
When terminal editors were king, this was a massive limitation. Today however, it doesn’t really matter. You can use nano for simple terminal based editing, and switch to a graphical editor when the job gets more complex.
This strikes a nice balance between speed and simplicity for many modern Linux users. You don’t need to spend weeks or months learning your editor. And that’s why nano is a fantastic choice for casual Linux users.
vim: The Power User’s Choice
I’ve been using Vim for about 2 years now, mostly because I can’t figure out how to exit it.
— I Am Devloper (@iamdevloper) February 17, 2014
vim is extremely fast, powerful, and focused. It’s also frightening. vim requires practice and patience to achieve reasonable proficiency. And it requires dedication to master.
The learning curve often scares away new users. To the uninitiated, it doesn’t seem worth training to learn a text editor when there are simple alternatives. And this is its weakness.
But, if you persist and learn vim, it is astoundingly powerful. Anything you can do in another editor, whether graphical or terminal based, is doable within vim. And all this power is easy to reach. You don’t need to hunt through multi-level menus to find what you want, you need only issue a quick keyboard command.
Watching a vim master work is awe-inspiring. The speed at which they carry out their task is unparalleled and makes the rest of us look like incompetent fools.
One last benefit of vim is its widespread availability. Many distributions have vim installed by default. Those that don’t surely have it in their repositories. And if all else fails, you can fall back on vim’s precursor, vi, which every meaningful distribution has installed by default. vi isn’t as powerful as vim, but it is interacted with in the same way and someone proficient in vim will feel at home in vi.
vim serves one and only one purpose; to efficiently edit text. While it’s not a trivial task to learn vim, doing so unlocks unparalleled efficiency and speed. If you are going to regularly use terminal based text editors, learning this powerhouse editor is a worthwhile investment.
There are several fantastic resources for those interested in vim. The first and simplest is a built-in tutorial. It is accessible by typing :! vimtutor from within the editor. It will get your foot in the door.
Or if you prefer the feel of a good book in your hands, there are two books I highly recommend. The first teaches the basics of vim (and vi).
The second is for those already familiar with vim’s basics, but looking to master it.
emacs: The Everything Editor
emacs isn’t so much an editor as it is a way of life. Unlike nano and vim, you’re not meant to dash into emacs, make a quick change to a file, and leave again. You’re supposed to live within emacs. To use it for note taking, organization, gaming, programming, terminal access, file access, web browsing, music playing, scheduling, email, and much more.
The whole point to emacs is that you can make it do absolutely anything you want as long as you’re willing to put in the time to configure it. In terms of ease-of-use, emacs falls somewhere between nano and vim. However, the broad feature scope and staggering customization options make it more complex than its competitors.
The biggest downside to emacs is that it doesn’t do any one job particularly well. vim is better at editing text. Lynx is better as a terminal web browser. And so on through its list of features.
The upside to emacs is that you never need to leave it. It’s blazingly fast and does 90% of what a computer user does already. The other 10% you can configure it to do yourself.
To gain the most from emacs, you’ll need to spend a few months getting familiar with it, then learn the Lisp programming language, and then spend the rest of your life tweaking it. And eventually you’ll become incredibly efficient with it… probably.
To get you started with emacs, I recommend the following book:
If you don’t want to buy a book, I suggest you refrain from Googling at first. emacs has been around since 1976 and has evolved quite a bit in that time. As such, there is a lot of conflicting and outdated information floating around.
Instead, stick to one comprehensive source of information, like the emacs manual, and exhaust its information. Then, once you are comfortable with emacs, carefully start Googling, taking in what you read with a grain of salt.
Wars and The End
Terminal based text editors have been the subject of long-standing rivalries in the Linux, and related communities. There is no shortage of opinions on which editor is best.
Opinions are like assholes. Everybody has one and most of them stink.
Each editor has its own strengths and weaknesses. nano is easy to learn and remarkably simple. vim is a very powerful but isn’t intuitive. And emacs is where you will spend the rest of your life trying to make it “perfect,” but never quite getting there.
If you intend to do a lot of work in a terminal, learning vim or emacs is worthwhile and will pay dividends throughout your future. If you intend to avoid the terminal as much as possible, using nano or picking up just the basics of vim will probably better suit you.
Let us know which text editor you choose (or have already chosen) in the comments, tell us why, and sign up for our newsletter to get cool goodies in your email!