Create and Edit Text Files Flashcards

1
Q

In vi how do you copy a line?

A

yy

*yank

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In vi how do you paste a copied line?

A

p (paste below cursor)

P (paste above cursor)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In vi how do you insert text?

A

i

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In vi how do you change to command mode?

A

esc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you cut a line?

A

dd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you cut multiple lines?

A

n dd

i.e 5 dd (cuts 5 lines)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you yank multiple lines?

A

n yy

i.e 5 yy (yanks 5 lines)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you undo a change in vi?

A

u

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you go to the bottom of a file in vi?

A

G

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you go to a specific line of a file in vi?

A

n G

i.e 24 G (jump to 24th line)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When in vi command mode how do you change a word?

A

cw

*removes word, transfers to insert mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you delete a single word in vi?

A

dw

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you delete a word excluding spaces in vi?

A

de

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When in vi command mode how do you change a line?

A

cc

*removes line, transfers to insert mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When in insert mode how do you enter replace mode?

A

R

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In vi how do you replace the first instance of text with other text?

A

:%s/>match>replace<
i.e :%s/youre/you’re
: denotes x mode

17
Q

In vi how do you replace matched text with other text?

A

:%s/>match>replace

18
Q

How do you issue linux commands from inside of vi?

A

:!>command<

i.e :!ls /etc

19
Q

In vi how do you save changes?

A

:w

20
Q

In vi how do you quit ignoring unsaved changes?

A

:q!