Welcome to the most active Linux Forum on the web.
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, 08: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, 08: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-29-2002, 11:46 PM   #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, 12: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, 04: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 04:04 PM.
Old 05-01-2002, 10:39 PM   #6
Registered: Jun 2001
Location: Houston
Distribution: CentOS 5.3
Posts: 142

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, 06: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, 08: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, 08:17 AM   #9
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,545

Rep: Reputation: 160Reputation: 160

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, 02: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 02:28 AM.
Old 02-05-2009, 11:34 PM   #11
LQ Newbie
Registered: Feb 2004
Location: Cornwall 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, 01:09 AM   #12
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,623

Rep: Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149Reputation: 2149
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, 05: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, 05: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, 05:54 AM   #15
Sayan Acharjee
Registered: Feb 2010
Location: Bangalore, India
Distribution: Linux Mint 13
Posts: 592

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 03:56 PM
Exit X Risetaker2003 Linux - Software 5 09-30-2003 08:10 PM
exit X ? w00t Linux - Newbie 11 06-01-2003 08:04 PM
exit xlord Programming 7 11-03-2002 11:33 AM

All times are GMT -5. The time now is 01:53 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration