now for our last section in this module. 103.8, the V I editor
now VI I is important to know about,
mainly because it's a very powerful editor,
but also because it's
pretty much the default editor. You could expect to find out any version of UNIX or lyrics, so we need to know how it works because you can't count on easier to use editors always being available, things like Leave pad or
So the navigation with the eyes done with the H J K Nell Keys.
And if you put if you know how to type touch type. If you move your hand over one letter to the right. Sorry,
one letter to the left. Your right hand moved one letter to left. Then you'll rest on those four keys, and you can get pretty used to the up and down with Agent J and K, now left and right.
If you're a touch typing, this should be a fairly easy here, uh,
I can also go to the beginning of the end of line by using shifted six or shifted for.
You'll notice there's a consistency here between these carrot being the beginning of the line character and the dollar sign being the end of the line character.
And I've got W to move to the next word B for the previous word,
each of the current word and then some other commands using the shift key
shift l puts me at the bottom of the screen. My cursor there
I can use Shift H ago, the top of the screen, so that's your high and low.
And then shift G sends me to the last line. The file
and I can also specify a specific line file, which we saw earlier when we're looking at some of the grip commands with the dash end.
If I knew I wanted get tow line 327 I could just type that in and go directly to that line number.
So let's have a look at V I,
and I'll go back to Miami
So I've got plenty of material to work with. You'll notice when I go into V. I tells me at the bottom how many lines are in this file and how many characters it contains,
so I get some of that information right from the beginning.
I'm hitting the Jakey, moving my cursor down
the k g, moving the cursor up,
l moves it to the right and
age moves into the left after Look at the keyboard cause I'm so used to doing this without looking.
But this is very much like the arrow keys. In fact, the arrow keys usually work in V. I have switched to the arrow keys.
A lot of people might like that better. But once you know the
the character of the curse of movement, it's not so bad.
type the dollar sign and go to the end of the line. A carrot symbol. I go the beginning of the line.
They're simple stuff.
lose me from one word to the next, and a word is some continuous string of characters. So if it's text, it'll be continuous text a ring. If it's a special character, like an angle bracket or square bracket.
Now I'm on a new word. I go to the next special character on the next word, and you can see how that works
be goes in the other direction.
So I'm getting be to go to the previous word.
And if I my cursor was here and I want to go to the end of the current word, I can have the e character
So these were kind of useful.
Be able to navigate within the file and, uh,
jumped to the beginning than the line. So they're having to deal with moving the curse around me. Annually
shift L, as we saw earlier,
puts me at the bottom of the current screen down there in the lower left corner,
whereas Shift H puts me at the top of the current screen
and shift G puts me at the end of the file at the very last line.
Now, as I mentioned earlier, I could go to a particular line number. So I
let's say I want to go to lying Number 327. I just tied 3 to 7,
Then type shift G, and it puts me at that line number.
I can't really tell because I don't see it within the file itself.
review some of the other commands for the different modes,
then we'll go back and explore some more options.
So there's two modes. There's the command mode and editing mode
and by default, when you when you added a file, you are in command boat. I have to engage in certain mode by typing a or some other character
go into that mode. And then I escaped to get back out of that mode to get back into command mode.
You'll see here on the table that commands
allow me to do all of my moving around copying and pasting.
And then when I've inserted data, Aiken use various commands within the insert mode to do things like,
copying, pasting, adding at the end of the line,
uh, opening lines above and below, where I'm where my cursor is.
This gives me a lot of flexibility for how I want to use the editor,
but I also have to know how to save file. So
shift in the semi colon key, I get the colon that you'll see that you'll open up a little cursor at the bottom of the window.
Here, I can write the founding
so I can just do Colin W Space founding,
and this saves my current file as some other name.
If I want to quit without
saving any changes, I can do a colon. Q.
If no changes remain, it will let me exit Changes have been made. I'll get a message. So I have to do que exclamation point or Q bang. In order to abandon those changes,
I can add it multiple files at one time with envy. I which is Khan Vice
s so I can quit all of them at the same time by doing the colon que es
uh, colon w Q rights and quits the current file
What can actually be replicated with Shift's easy, which is actually faster because the shift in the Z K right next to each other
I can even revert to a previous
version of my file by using the Colon, E
Let's explore a few of these options.
and make sure that was editing the correct file.
So V I gives me, uh, my helper v I You could also use them, which gives you you can use behind a visual mode rather, which gives you some additional
features to make life a little bit easier.
Uh, but we can see there's a few other items I can use behind easy mode with Dash y. You might like that
if you're new to V I. A lot of people complain that the eye is difficult to learn,
but once you get started with it and start playing around, it becomes second nature very quickly.
I can also look at some different
options for launching V. I like,
running a certain command before loading a file. I could break out of the shell and run a command separately, but let's go back and edit that password file.
Also not password messages that she passwords file. It's Don't do that one
insert some texture, obviously you're not gonna edit password directly. That's usually not the way you would
would modify this file, but it's a good one for illustrating these things,
So I know I've got a sequel. Databases command here somewhere
or log in somewhere. So I'm gonna do slash for a search just type sequel,
and it finds the my sequel line,
and I could hit end to go to the next result of that search that's toddling between the two that knows about
Maybe this, uh, home directory is no longer correct, so I can hit the ikey
put in some text. So my sequel, Dash Home might be the name of the directory,
just as an example now had escaped to go back to command mode, I can navigate the file as before
I can hit you to undo, which is nice.
I'll put that back in there,
for adding or deleting text,
I can hit the ex key to delete one character at a time.
I'll insert that again to put some more text.
the Deke Command and the W Command for delete word.
So I deleted whatever text was between my cursor and the next delimit ER, which is
a coal. In this case,
I can also delete an entire line, and I can copy and paste lines, which will see here in a little bit.
For instance, let's say I want to
open a line above the line that I'm on Aiken type shift oak that opens a new line. It puts me in to insert mode.
It escaped to get out of that mode.
the D for delete body for two days together deletes the line
so I can delete an entire line.
I can also do a copy and paste so I can tie. Why? Why? For Yank
and P for put. And now I've just duplicated that line.
I could also do something a little more tricky. I can put numbers in front of these things, So if I want to delete five lines, I can take the number five D D. Now I've just got rid of five lines.
I can also yank five lines. So five. Why? Why
tells me at the bottom five lines yet. And I can hit P to pace those
lines that I just copied.
So it's hard to see this when you're looking at the editor because you don't really see what's going on behind the scenes. But if you
practice with the commands, find yourself a good V. I cheat cheat. There's plenty of those available
some of the shortcuts. For all the commands that I've been trying to show here
I could also do other things like Shift A puts me at the end of line, puts me into insert mode
shift. Oh, whoops. Not shift. Oh, sorry about that. It's the wrong character to use
shift. I go to the end of line first dollar sign
shift I puts me at the beginning of the line, puts me and insert mode.
So these air nice little short cuts that you can get used to when you're using the editor more frequently,
you can also go into visual mode,
which allows you to select a text
more like you would with a mouse.
And that could be useful when you're trying to. Uh,
do do you copy and pasting operations and a little bit more of a
I personally don't like visual motive. I'm already used to the normal mode.
Now the zero character puts me at the beginning of the line,
as well so I can get there
without having to curse her over and deal with that extra extra work.
So these are some of the commands I was just reviewing.
So in starting to left, the cursor inserting at the beginning of the liner at the end of the line, inserting text above or below
opens below shift opens above.
If I'm if I'm copying text with the Yank Command,
use Why Why do you think the lines above my cursor?
Why? To link yank lines below my cursor and then peed to pace the lines below the cursor and shifted Peter paste above.
So when I'm using shift, I'm I'm either yanking or putting above. But I'm using the wire, the p by themselves. I'm yanking below or putting below.
And then we shot. We saw the you command for undoing changes
so the eyes are very powerful. But again, it's a bit of a learning curve,
so get familiar with the navigation. Get familiar with the copy, pasting, deleting and navigating at the word level or at the line level, and you'll be in great shape for the exam.
And I try not to rely on other editors. If you can enforce yourself to stick with the eye until you've mastered it, it'll pay off in the end.
All right, that gets us to the end of module 103 So our next module is one of four, which is, uh, file systems and the file system hierarchy standard.
See you then. Thank you.