Sequence 1: Navigating with vi
- Log in as user student
[student@stationX ~]$ cp /etc/passwd ~
[student@stationX ~]$ vim ~/passwd
- First, try moving around using such as the arrows, PgUp, PgDn. They should all work as expected. Note, however, that on older systems they might not. moving from word to word with the w and b keys. moving by sentence (the parentheses) and paragraph (the curly braces)
- Try combining numbers with movement keys.
7. Press the i key.
The arrow keys, Home and End still move your cursor
- Exit insert mode by pressing Esc.
- Try pressing the u key. This will undo each change that you made. Changes can be re-done with Ctrl-r
- The ex mode is invoked by typing : while in command mode.
- At the ex prompt (:) enter set nu.
- Try entering ex mode again and typing :set nonu.
- Try jumping to line 5 by typing 5G.
G to the end
1G to the first line
- Search feature: /root.
press n and N to navigate.
- Try running :q. :q!
Sequence 2: Configuring vim
[student@stationX ~]$ vim ~/.vimrc
[student@stationX ~]$vim /etc/passwd again.
Sequence 3: Configuring basic sudo privileges with vim
[student@stationX ~]$ su –
[root@stationX ~]# visudo
The line appears about halfway down the file and looks like this:
root ALL=(ALL) ALL
yy “yanks” (copies) the current line and p “pastes” it one line down.
cw studen Esc.
w cw stationX
The line should now read:
student stationX=(ALL) ALL
7. Exit insert mode by pressing Esc. :wq
[student@stationX ~]$ ls /etc/pki/CA
ls: /etc/pki/CA: Permission denied
[student@stationX ~]$ sudo ls /etc/pki/CA
sudo will remember that you have already authenticated for five minutes before prompting you again.
Challenge Sequence 4: Learning more with vimtutor
[student@stationX ~]$ vimtutor