:e
file1
|
Loads
the specified file for editing
-
You can also specifi absolute and relative
path
|
:r
|
Load the
file content of the file again
|
:!
|
Allows
you to run shell commands from within vi example: !ls /etc
|
i
|
insert
text and not replace it
|
R
|
over
write existing text when new text added
|
cw
|
remove
current word cursor is on and insert into insert mode to add text
|
cc
|
replace
the entire of line of text
|
l
|
moves
cursor one character to the right
|
h
|
moves
cursor one character to the left
|
j
|
moves
cursor down one line
|
k
|
moves
cursor up one line Yank Term used to copy text. Use YY to yank a line
of text.
|
yy
|
will
yank/copy entire line the cursor is currently on
|
2yy
|
will
copy the current line of text as well as the line underneath it (2lines)
|
3yy
|
will
copy three lines, 4yy 4 lines of text 5yy
|
p
|
will
paste the contents from yanked yy text, starting on the line after your
cursor
|
P
|
uppercase
P will paste the yanked line(s) starting on the line before the cursor
|
5G
|
moves
your cursor to line 5
|
5gg
|
moves
your cursor to line 5 (note case sensitive)
|
G
|
Moves
the cursor to the beginning of the last line in the file
|
1G
|
Moves
the cursor to the first line of the file
|
L
|
Also
moves the cursor to the beginning of the last line on the terminal screen
|
H
|
Moves
the cursor to the first line on the terminal screen
|
o
|
opens insert
mode to insert text, creates a new line below your current cursor position
|
u
|
undo
|
cc
|
Removes
the entire line and places you into insert mode
|
/ -
search, /root
|
will
search the file for root you can navigate to the next occurrence using the
n key
|
?
|
is the
same as / as it relates to searching
|