Hello. I'm trying to learn LInux. The book I read states that you should know how to use Vi. What is your opinion about that?

vi is not Linux. There are so many text editors that I would not call this a requirement any longer. Maybe 3 decades ago but not now.

But hey, why not learn ed too?

PS: I would never call vi a "word processor.
PPS: About the only hard thing about vi is how to quit and optionally save.
Last PS: vi is a screen-oriented text editor. Read https://en.wikipedia.org/wiki/Vi

Thanks for your reply. I'm just trying to find out what other people think. I could also have told about a book on my shelf about C++, from 2002.

Since you shared your book on C++ let me share I have two books on C. Well, one now that someone borrowed my old version of:
"THE C PROGAMMING LANGUAGE" by Kerninghan and Ritchie.

Now I only have the Second Edition.

Only if, "you have too." I "had to" the other day in DD-WRT, so I googled what I needed to. Without an net connection I would have been toast though.

vi has a steep learning curve. Most users learn only a fraction of its features because they're all keystroke-based. You have to look them up and know they're available. Even just a fraction of its features, however, is all most people need to use vi productively.

Once you learn how to use the core set of features, vi is the most lightning-fast editor you're likely to come across. It's the only one that can keep up with my thought processes as I'm writing or maintaining code. All the others bog me down.

Another advantage of vi is that it's included in every Linux distribution you're likely to use. Once you learn it, it will always be there for you or can be easily installed for you by an admin.

Learning vi is like learning touch typing. It takes a few weeks of discipline to learn it, but doing so saves you a lifetime of eyestrain and mental fatigue. Chances are if you balk at vi, you'll balk at Linux coding anyway.

Yes absolutely.

vi is the ONLY editor (it is not a word processor) that ships with ALL Linux distributions and UNIX variants.

It is simple to learn and simple to use, and you only need a few basics to save yourself a lot of headaches when somethng goes awry and you find yourself trying to get your machine back online, or even attempting to boot when you're fixing a problem from a rescue disk or boot. If you do any low level Linux work with Androids or other tasks that involve using BusyBox, vi is going to be your ONLY editor.

Most seasoned developers are adept at using vi as well, most folks use Vim (Vi Improved), which is actually just a drop in replacement that supports several plugin systems and affords you much in the way of configuration and extensibility.

MOST Unices do ship with ed as well, but that is a line editor, not a full screen visual mode editor. In the event you choose not to become familiar with vi, then you must learn ed, because there will be times when one of those will be your only option to edit files on a crippled system, and being able to work on and edit a file while seeing the entire page is much less intimidating than working with one line at a time.

The majority of Linux systems ship with the Vim variant of vi, yet Debian GNU/Linux is a notable exception, and there are several clones of vi, such as Elvis and on BSDs, nvi. Except for very advanced features, all of them work exactly the same and are usually invoked merely by entering "vi" on the command line.

vi was originally written by Bill Joy when he needed to write the first actual IP stack that worked for UNIX when he was a computer science graduate student at the UC Berkely, because he wanted to extend the capabilities of ed, so he wrote ex, and then extended that line editor with a "visual mode", which soon thereafter became known as vi, because ex opened in visual mode (displaying a full page of text at a time).

To this day, it remains the most used editor on all variants of UNIX and Linux.

So yes, you should definitely learn and become comfortable with the basic usage of vi. if the question comes up on an interview and you don't know how to use vi, that could very well be the end of your job interview.

There are several tools you can make use of for learning vi in a fun environment in just an hour or so, and Vim itself comes bundled with "Vim Tutor"

https://openvim.com
https://vim-adventures.com
https://www.systutorials.com/vim-tutorial-beginners-vimtutor/
https://www.linux.com/training-tutorials/vim-101-beginners-guide-vim/
https://scotch.io/tutorials/getting-started-with-vim-an-interactive-guide

I hope that helps!

You do not NEED vi, you may use any other text editor. You will be able to work without any problems, as long as you do not work on multiple platforms with different configurations.

BUT:
vi is available on all linux systems.
I personally like and use it.

There are well thought arguments for vi in the thread, I will not repeat them.

vi is in the standard configuration for many tools (e.g. gut for the comment function during check-in).

Today "vim" is used instead of "vi" - my RHEL box says

which vi

vi:      aliased to vim

So your book may be somewhat old. However I find vim to be really powerful and helpful in getting work done. Its use of Regular Expressions (regexes) allows doing fairly complicated processing with just a few keystrokes, and its very extensive undo/redo has saved me a ton of work many times.

But there is a downside, there's a reasonably steep learning curve. You have to learn a bunch of commands and train your fingers to carry them out. But then you can get a lot of work done fast and with less effort.

At the other extreme - learn the nano editor. Very easy to learn and use, and sufficient for the beginner who just wants to type in some lines and do a bit of editing. But very limited in power.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.