And we're ready for our next demonstration.
We can begin by taking a look at our editors. We'll take a look at nano and vim,
all of this being on our Alma Linux 8 system. And look at this, a
glorious command line in which we can start learning about our editors.
I'm working on my Alma Linux 8 system, and we're going to go through
and install some additional software.
So to be able to do this, I need to elevate my privileges.
We're going to use dnf, our Dandified YUM, and we can then go
through and say that we want to install, ‑y then just goes
ahead without further prompts.
And we can go through and install vim‑enhanced.
As far as our editors are concerned,
we have vi installed, but vi improved is then vim.
So we need to add this through to our system.
We can also look at the nano text editor, as we don't have it by default.
And we're also going to add in rsync, which we can use for copying files.
We'll look at that later on.
And then for working with our Git repositories, we're adding in git‑core.
So with these then listed as our packages to install,
I hit the big Enter key, and away we go and allow these to install.
We'll see it happens relatively quickly, and we can allow it to run
through, and we'll be able to then clear our screen, so Ctrl+L. If I
want to then go through and edit a file,
I can go through, let's say, and vim file1.
Now this is a modal editor, and there's no menu. We need to hit i
for insert, and then we can go through and say this is text. When
we're ready, I can go through then hit escape and colon, and I
use x to save and exit.
So we do just need to be aware that we're in the correct mode.
If I go back into the file now, if I want a copy of this line,
I can use yy and then lowercase p to paste.
If I use uppercase P, I pasted above my line, and we'll see this happening.
I'm going to use lowercase o to insert a new line, and
then say this is a new line, hit escape.
That takes me back, then into my normal mode.
I can then start using the characters as commands.
I can use yy to copy this line.
I move up to the top of the document, and then use uppercase P, so
I'm pasting above my current line. Again, once I'm ready and I want
to save, I can use escape and colon. There's no difference, but
other people use wq to write and quit rather than what I normally
use, colon and x.
Wq is the same.
Now if I use nano and then file1, we see I get a simple menu.
If I want to then go through and start typing text, I just type the text.
If I want it to be on a new line,
I just hit Enter, and we can see there. Once I'm ready,
I can use Ctrl+X to save, and then just use y to say
yes, write to file1, and hit Enter.
So the learning curve is much shorter with nano. It tends to be
the default editor that you find on Ubuntu‑based systems, but
it's not as powerful as using vim.
If you're really interested in learning vim,
we can go through and run vimtutor. This then opens up a
document, and we can then read the document.
They say it's going to take roughly 25 to 30 minutes to run through,
but it can then go through and help you learn.
But it's just practice.
If you're going to be working with Linux a lot,
it's probably worth learning vim. If you're not going to be working a lot
with vim, then it might be better spent learning nano.
I'm just going to go through escape, colon, and quit.
Don't need to save any changes. I haven't made any.
And now we're out of vimtutor. In our next clip,
we're going to come back and look at how we can use the stream editor to edit a configuration file on our Ubuntu system.