How Do I Save Changes to a File in Linux?
Contents

How do I save and edit a file in Linux?

To save a file, you must first be in Command mode. Press Esc to enter Command mode, and then type :wq to write and quit the file.
…
More Linux resources.

Command Purpose
$ vi <filename> Open or edit a file.
i Switch to Insert mode.
Esc Switch to Command mode.
:w Save and continue editing.

How do I save changes in Unix?

Be sure to use the save command often when editing an important document.
…
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
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest