LX0-103 · Question #44
What happens after issuing the command vi without any additional parameters?
The correct answer is D. vi starts in command mode and opens a new empty file.. Invoking vi with no arguments starts the editor in command mode with a new, unnamed empty buffer ready for input.
Question
What happens after issuing the command vi without any additional parameters?
Options
- Avi starts and loads the last file used and moves the cursor to the position where vi was when it
- Bvi starts and requires the user to explicitly either create a new or load an existing file.
- Cvi exits with an error message as it cannot be invoked without a file name to operate on.
- Dvi starts in command mode and opens a new empty file.
- Evi starts and opens a new file which is filled with the content of the vi buffer if the buffer contains
How the community answered
(45 responses)- B2% (1)
- C2% (1)
- D96% (43)
Why each option
Invoking vi with no arguments starts the editor in command mode with a new, unnamed empty buffer ready for input.
vi does not track or restore the last used file or cursor position when invoked without arguments; that behavior belongs to session-restore features not present in standard vi.
vi does not prompt the user to choose or create a file interactively on startup; it simply opens an empty buffer.
vi does not exit with an error when called without a filename; a filename argument is optional, not required.
When vi is launched without a filename argument, it opens successfully in command mode displaying an empty buffer. The user can then begin inserting text or explicitly name a file when saving with :w filename, so no file argument is required for invocation.
vi does not pre-populate a new buffer with leftover content from a previous buffer when started without arguments under normal operation.
Concept tested: vi editor startup behavior without filename argument
Source: https://man7.org/linux/man-pages/man1/vi.1p.html
Topics
Community Discussion
No community discussion yet for this question.