How Do You Save and Exit in Unix?
Contents
Command Purpose
:wq or ZZ Save and quit/exit vi.
:q! Quit vi and do not save changes.
yy Yank (copy a line of text).

How do you save in Unix?

NOTE: The :! and :sh commands make it easy to execute UNIX commands without exiting Vi.
…
bold.

:w save changes (i.e., write) to your file
:wq or ZZ save changes to file and then qui
:! cmd execute a single command (cmd) and return to vi
:sh start up a new UNIX shell – to return to Vi from the shell, type exit or Ctrl-d

How do I save and exit vi file?

To get into it, press Esc and then : (the colon). The cursor will go to the bottom of the screen at a colon prompt. Write your file by entering :w and quit by entering :q . You can combine these to save and exit by entering :wq .

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest