ove cursor to the last line of the file with one key: G Use one key to move cursor to bottom line of screen: L Move cursor to line 32 with three keys: <32>G Turn on/off line numbers: :set nu , :set nonu Forward/backward one page: ctrl-f , ctrl-b Join the current line with next line: J Replace the whole current line with “abc” with five keys: Append text “abc” at the end of current line: A You just deleted one line by accident. Undo this with one key: u Delete next six lines including current line with three keys: 6dw Delete from cursor to the rest of current line with one key: D Save your changes without quitting vi: :w Delete next five lines from current line and paste them back at the end of the file: 5dd, p Delete next seven characters from cursor with two keys: 7x Swap current char with the next one with just two keys: r Temporarily leave vi as a background process and then come back to vi: ctrl-z You are in vi with file science.txt, turn on search highlight and find all strings of “child”: :set hlsearch , / , ? You are in vi with file science.txt, replace all “the”s with “abc” without prompt: :n,m s///g Clear the highlights from last search: :set hlsearch! Read a file a.cpp into vi below the current line: :r
pls check if my unix answers are correct and provide corrections if necessary(commas separate the commands)
Move cursor to the last line of the file with one key: G
Use one key to move cursor to bottom line of screen: L
Move cursor to line 32 with three keys: <32>G
Turn on/off line numbers: :set nu , :set nonu
Forward/backward one page: ctrl-f , ctrl-b
Join the current line with next line: J
Replace the whole current line with “abc” with five keys:
Append text “abc” at the end of current line: A
You just deleted one line by accident. Undo this with one key: u
Delete next six lines including current line with three keys: 6dw
Delete from cursor to the rest of current line with one key: D
Save your changes without quitting vi: :w
Delete next five lines from current line and paste them back at the end of the file: 5dd, p
Delete next seven characters from cursor with two keys: 7x
Swap current char with the next one with just two keys: r<c>
Temporarily leave vi as a background process and then come back to vi: ctrl-z
You are in vi with file science.txt, turn on search highlight and find all strings of “child”: :set hlsearch , /<child> , ?<string>
You are in vi with file science.txt, replace all “the”s with “abc” without prompt: :n,m s/<the’s>/<abc>/g
Clear the highlights from last search: :set hlsearch!
Read a file a.cpp into vi below the current line: :r <a.cpp>
Step by step
Solved in 2 steps