프로그래밍/Linux

[Linux] Vi Command

bluecandyg 2022. 11. 3. 13:48
  • Move Line
# top
$ gg

# bottom
$ G

# left, up, down, right
$ h, j, k, l

# move first of line
$ ^

# move last of line
$ $

 

  • Edit
# undo
$ u

# delete
$ x

# backspace
$ X

# replace 1char
$ r

# move to last word and insert
$ A

# move to next line and insert
$ o

# delete line
$ dd

# delete all after cursor
$ D

# copy line 
$ yy

# paste
$ p

# replace word
:$s/find word/replace/word/
:$s/find word/replace/word/ig (i: ignore case / g: global)