In the vi editor, which command appends new text at the end of the current line?
Computer Science
Linux
Difficulty: Easy
Choose an option
-
AI
-
Bi
-
Ca
-
DA
-
ENone of the above
Answer
Correct Answer: A
Explanation
Introduction / Context:Text editing in vi involves switching between normal and insert modes. Knowing the difference between lowercase and uppercase commands allows faster editing. Appending specifically at the end of a line is a common task.
Given Data / Assumptions:
- You are using vi/Vim in normal mode.
- You want to add text at the end of the current line without manually moving with arrow keys.
Concept / Approach:
The uppercase command A moves the cursor to the end of the line and enters insert mode, ready for appending. This differs from lowercase a, which appends immediately after the cursor only.
Step-by-Step Solution:
Open a file in vi.In normal mode, press A.Cursor jumps to end of line, then insert mode starts.Type additional text and press ESC to return to normal mode.Verification / Alternative check:
Compare A with lowercase a. Use A to quickly append to a line regardless of cursor position.
Why Other Options Are Wrong:
- I: inserts at beginning of line.
- i: inserts before cursor.
- a: appends after cursor, not end of line.
- None: incorrect because 'A' is correct.
Common Pitfalls:
- Confusing lowercase and uppercase commands in vi—they have different behaviors.
- Assuming a will always take you to end of line—it does not.
Final Answer:
A.