LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Server NOOB - how do i save a file after VI? (https://www.linuxquestions.org/questions/linux-server-73/server-noob-how-do-i-save-a-file-after-vi-550286/)

mitchell7man 04-30-2007 10:40 PM

Server NOOB - how do i save a file after VI?
 
Hello, after VI.... a file, how do i save it and return to command prompt?

sparc86 04-30-2007 11:05 PM

press:

esc
:
w

(this will save)

you can also do:

esc
:
wq!

(this will save and leave the editor)

mitchell7man 04-30-2007 11:14 PM

do i press that all at the same time or do i press escape then : then wq?

jschiwal 04-30-2007 11:58 PM

You press them sequentially.

mitchell7man 05-01-2007 12:00 AM

Ok, thanks

michaelk 05-01-2007 03:57 AM

actually
:wq - save file and exit
:q - quit, will refuse if unsaved changes exist
:q! - quit without saving changes.
:x - save file if changed and quit

Just google for a complete list of vi commands.

scollier 05-03-2007 01:00 AM

If you have a redhat distro, you may want to run through "vimtutor", that will open a file with a VIM guide and you just walk your way through it.

IsaacKuo 05-03-2007 01:06 AM

If you're lazy, you can type in "ZZ" to save and quit (capitalization matters).

mitchell7man 05-03-2007 11:20 AM

Ok, thanks, :)


All times are GMT -5. The time now is 10:57 PM.