Difficulty: Medium
Correct Answer: #
Explanation:
Introduction / Context:
Classic vi grew up on hard-copy and glass TTYs with limited keysets. Before modern Backspace behavior was standardized, terminal drivers provided special erase and kill characters for command-line editing. Knowing these legacy conventions helps when working on constrained systems or through raw serial consoles.
Given Data / Assumptions:
:
).
Concept / Approach:
Historically, the hash mark #
acted as the erase character, removing the immediately preceding character on the command line. The at sign @
often acted as the line-kill character, clearing the entire input line. While modern terminals support the Backspace key, these legacy controls still appear in documentation and older environments.
Step-by-Step Solution:
:
in vi.If you mistype, press #
to erase the last character (on systems honoring this convention).Use @
to erase the whole line if necessary (legacy behavior).Press Enter to execute once the command is correct.
Verification / Alternative check:
Check your terminal settings with stty -a
. The erase
and kill
characters show the current bindings, which may be Backspace and Ctrl+U in modern setups. If set to #
and @
, the described behavior will occur in vi's command-line entry.
Why Other Options Are Wrong:
:!ls
), not for editing mistakes.#
is traditionally used for single-character erase in this context.
Common Pitfalls:
Assuming your modern Backspace will always work in raw terminals; not checking stty
settings; confusing vi's insert-mode editing with ex command-line editing rules.
Final Answer:
#
Discussion & Comments