Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-29-2002, 09:14 PM   #1
LQ Newbie
Registered: Jan 2002
Location: Canada
Distribution: Slackware 8.0
Posts: 20

Rep: Reputation: 0
How to exit vi?

Ok, I've been using linux on console only PC for a couple days now and one big thing is really bothering me...

How do I exit vi/emacs/joe?! also, how do I save + open files? I know how to stop the process (ctrl + Z) but I doubt thats the best way to exit :-)

This is really bugging me b/c its sooo simple and I've been trying key combos for hours, but I've finally decided to just put my pride aside and ask. So please, anyone, how do I exit?
Old 04-29-2002, 09:29 PM   #2
LQ Newbie
Registered: Apr 2002
Posts: 6

Rep: Reputation: 0
vi - press escape to get into command mode if you re not already in command mode (if you are, it s OK to press it anyway). :q to quit :w to save, :wq to do both.

emacs - ^X^S to save, ^X^C to quit
Old 04-30-2002, 12:46 AM   #3
Registered: Apr 2002
Posts: 84

Rep: Reputation: 15
also, adding an exclamation mark at the end of the command means "do it!" - as in


(yes, I know I made changes, but quit anyway, and don't bother me about it...)

Old 04-30-2002, 01:28 AM   #4
LQ Newbie
Registered: Jan 2002
Location: Canada
Distribution: Slackware 8.0
Posts: 20

Original Poster
Rep: Reputation: 0
Thank You!

Btw, this kind of super-newbie information should maybe be put in man pages? maybe a section of the man dedicated to newbs? Just so that people might have some idea where to start...

this also applies to exiting man pages I figured out too... :-)
Old 05-01-2002, 05:02 PM   #5
rockin chair
Registered: Apr 2002
Location: Little Rock, AR
Distribution: RH v.7.2, Suse 8.0
Posts: 12

Rep: Reputation: 0
For more information on the subject of vi, you might want to review the following thread, where I asked information regarding vi

That might give you more information.

Last edited by rockin chair; 05-01-2002 at 05:04 PM.
Old 05-01-2002, 11:39 PM   #6
Registered: Jun 2001
Location: Houston
Distribution: CentOS 5.3
Posts: 139

Rep: Reputation: 15
There is a really good vi command reference at:

For Joe, ^kz will stop the job, not a good thing. Use ^kx to save the file and ^c to cancel the file or any changes. At any time in joe, use ^kh and you'll get a split screen with the commands in the top half. ^[. takes you to the next help page if needed. Use ^kh again to get rid of it. It is very fast.

Emacs is not a good one to start with. I'd get vi or joe down well first.

BTW, to get out of man pages, hit q
Old 05-02-2002, 07:16 AM   #7
Registered: Aug 2001
Location: London UK
Distribution: Redhat 7.2, soon to be LFS!
Posts: 42

Rep: Reputation: 15
Jed or even better, XJed is a V good editor IMHO.

Comes with syntax highlighting, can be set up to emulate a number of other editors, the default being emacs so its an easy transition.

Doesnt have the HUGE overhead of LISP and all the emacs baggage but does have its own S Lang thingy should the need arise to go beyond the norm.

small, lean and mean

XJed forevaaa

Old 05-02-2002, 09:08 AM   #8
Registered: Dec 2001
Location: Kent in UK
Distribution: Fedora 2
Posts: 170

Rep: Reputation: 30
I use a small simple editor joe. Bit like wordstar remember that.
rpm for it on Redhat distro and probably many more.
Sorry I hate vi!
Old 05-02-2002, 09:17 AM   #9
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232

I use joe, too. It's not simple, quite many options... I can remember all commands I need, and there is good help.
Old 05-03-2002, 03:26 AM   #10
Registered: Apr 2002
Location: The District
Distribution: FreeBSD, OBSD maybe Gentoo and Winblech XP
Posts: 291

Rep: Reputation: 30
I use vi cause every *N*X has it. The BSD versions are tricky sometimes.

i or insert to insert text
ii ir insert insert to replace (overwrite)
arrow keys to navigate
esc :q! to exit with out changes
esc :wq to save and exit
my fave
esc shift^ZZ to save and exit.

same as above but no arrow keys and sometimes no insert i(only)
esc takes you to command mode and you can navigate
.with keys

x =delete
h,j,k,l = arrows
just the very basics
Almost forgot that *BSD has an editor ee I like alot when you're done editing
esc and you get a little menu

Last edited by 5amYan; 05-03-2002 at 03:28 AM.
Old 02-06-2009, 12:34 AM   #11
LQ Newbie
Registered: Feb 2004
Location: UK
Distribution: Fedora
Posts: 3

Rep: Reputation: 0
Question vi in ssh

Help please.
I'm connected to debian through SSH and have vi running with resolv.conf open and close to mashing it up which I don't want to do. Esc :q isn't working. How can I exit without saving mistakes?
Old 02-06-2009, 02:09 AM   #12
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 18,141

Rep: Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671
Esc :q isn't working.
what exactly do you mean???

If you use the Esc key, that brings up the cmd line beginning with ':'

If you HAVEN'T made any changes


will quit+no save


will quit+no save if you HAVE made changes


will exit+save changes
Old 02-06-2009, 06:41 AM   #13
Senior Member
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Originally Posted by molotov View Post
Help please.
I'm connected to debian through SSH and have vi running with resolv.conf open and close to mashing it up which I don't want to do. Esc :q isn't working. How can I exit without saving mistakes?
Old 03-17-2010, 06:51 AM   #14
LQ Newbie
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0

in Vi I press ESC key but I don't get the : fact theres no way I can get any text to appear, or close Vi.

using Arch Linux and Openbox
Old 03-17-2010, 06:54 AM   #15
Sayan Acharjee
Registered: Feb 2010
Location: Chennai, India
Distribution: Manjaro
Posts: 623

Rep: Reputation: 64
When you will press escape the insert mode will be disabled, then you need to type : After that you can provide q! the hit enter.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between exit 1 and exit kushalkoolwal Programming 6 10-20-2005 04:56 PM
Exit X Risetaker2003 Linux - Software 5 09-30-2003 09:10 PM
exit X ? w00t Linux - Newbie 11 06-01-2003 09:04 PM
exit xlord Programming 7 11-03-2002 12:33 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration