I cannot save or quit in vi.

General support questions
Post Reply
dinga
Posts: 1
Joined: 2017/02/10 14:11:38

I cannot save or quit in vi.

Post by dinga » 2017/02/10 15:44:56

I just set up CenTOS6.3 on VirtualBox.
When I opened a terminal and entered into vi, I cannot save a file or quit.
The ':' key does not work.
Whenever I typed ':', it beeps.
The ':' key works just fine on other vi editors. It just does not work on the CentOS desktop.
Can anyone help?
Thanks.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: I cannot save or quit in vi.

Post by TrevorH » 2017/02/10 16:31:59

First off: CentOS 6.3? Really? It's 5 years old and absolutely *riddled* with high severity security vulnerabilities and should not be used. Run yum update to get yourself up to date and on 6.8.

For the immediate issue: hit Esc first, then :q! to quit without saving or :x to save and exit.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: I cannot save or quit in vi.

Post by MartinR » 2017/02/10 16:42:18

or :x to save and exit
We've all had editing sessions like that! ;)

Whoever
Posts: 1357
Joined: 2013/09/06 03:12:10

Re: I cannot save or quit in vi.

Post by Whoever » 2017/02/10 16:51:17

To save and quit in vi/vim, just type (in command mode):

Code: Select all

ZZ

volisizy
Posts: 1
Joined: 2017/05/25 02:10:12

Re: I cannot save or quit in vi.

Post by volisizy » 2017/05/25 02:29:52

ESC to go to command mode en type ":qa!" (without quotes)

source: multiple ways to quit vim

Post Reply