nerdexam
CompTIA

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.

GNU and Unix Commands

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)
  • B
    2% (1)
  • C
    2% (1)
  • D
    96% (43)

Why each option

Invoking vi with no arguments starts the editor in command mode with a new, unnamed empty buffer ready for input.

Avi starts and loads the last file used and moves the cursor to the position where vi was when it

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.

Bvi starts and requires the user to explicitly either create a new or load an existing file.

vi does not prompt the user to choose or create a file interactively on startup; it simply opens an empty buffer.

Cvi exits with an error message as it cannot be invoked without a file name to operate on.

vi does not exit with an error when called without a filename; a filename argument is optional, not required.

Dvi starts in command mode and opens a new empty file.Correct

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.

Evi starts and opens a new file which is filled with the content of the vi buffer if the buffer contains

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

#vi#text editor#command mode#empty file

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice