Create and Edit Text Files Flashcards
In vi how do you copy a line?
yy
*yank
In vi how do you paste a copied line?
p (paste below cursor)
P (paste above cursor)
In vi how do you insert text?
i
In vi how do you change to command mode?
esc
How do you cut a line?
dd
How do you cut multiple lines?
n dd
i.e 5 dd (cuts 5 lines)
How do you yank multiple lines?
n yy
i.e 5 yy (yanks 5 lines)
How do you undo a change in vi?
u
How do you go to the bottom of a file in vi?
G
How do you go to a specific line of a file in vi?
n G
i.e 24 G (jump to 24th line)
When in vi command mode how do you change a word?
cw
*removes word, transfers to insert mode
How do you delete a single word in vi?
dw
How do you delete a word excluding spaces in vi?
de
When in vi command mode how do you change a line?
cc
*removes line, transfers to insert mode
When in insert mode how do you enter replace mode?
R
In vi how do you replace the first instance of text with other text?
:%s/>match>replace<
i.e :%s/youre/you’re
: denotes x mode
In vi how do you replace matched text with other text?
:%s/>match>replace
How do you issue linux commands from inside of vi?
:!>command<
i.e :!ls /etc
In vi how do you save changes?
:w
In vi how do you quit ignoring unsaved changes?
:q!