Vi Exit


Exiting a file in vi.



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



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



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


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 *