101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 38


Which of the following vi commands deletes two lines, the current and the following line?

Show Answer
Correct Answer: C

In vi, the command '2dd' deletes the current line and the following line. The 'dd' command deletes the current line, and prefixing it with a number specifies the number of lines to be deleted. Therefore, '2dd' effectively deletes two lines: the one where the cursor is currently positioned and the one immediately below it.

Discussion

5 comments
Sign in to comment
mrironOption: C
Dec 21, 2020

2dd is correct answer

mvpVN
Feb 24, 2021

Correct. 2dd deletes two lines the cursor is on

aMiPLOption: C
Mar 31, 2021

2dd easy to test in vi. Correct! If you press one 'd' it won't do anything.

demarkoOption: B
Dec 20, 2020

Answer is B = 2d

kipnggeOption: C
Jul 21, 2022

Answer is 2dd https://linuxize.com/post/vim-delete-line/

NinymoOption: C
Mar 24, 2024

Answer: C