Vi Exit

[problem]

Exiting a file in vi.

[/problem]

[solution]

There are quite a few ways to exit a file in vi. Here are some of my favorites.

[/solution]

[example]

The standard: :wq

Force, in the case of read-only: :wq!

Abort updates: :q!

Reset the file without writing: :e!

Quick save and exit: 😡

Lazy one, without using a colon: ZZ

Going to another file: n filename

Go back to the first file, when you’v edited with wildcard or list of files: :rew

[/example]

[reference]

[tags]vi, Unix Coding School[/tags]

[/reference]

If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

Your email address will not be published. Required fields are marked *