All mock tests are FREE till 31 December — register to save your progress

Match the following basic vi editor commands in UNIX with their functions.
List I (Command): (a) dd (b) yy (c) p (d) u
List II (Function): (i) Copies (yanks) the current line into the buffer (ii) Undoes the last change made to the file (iii) Deletes the current line (iv) Pastes the buffer's contents after the cursor
Choose the correct match from the options given below.

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: D. (a)-(iii), (b)-(i), (c)-(iv), (d)-(ii)

Explanation

In vi's command mode, dd deletes the entire current line (matching iii), yy "yanks" (copies) the current line into the unnamed buffer without deleting it (matching i), p pastes whatever is currently held in that buffer into the text immediately after the cursor (matching iv), and u undoes the single most recent edit made to the buffer (matching ii). This gives a-iii, b-i, c-iv, d-ii, option (iv).

More Software Engineering questions