joi, decembrie 16, 2010

Save and exit in Linux text editor VI

The Linux vi editor is a tool to edit files in the Linux command line terminal. It has been a popular text editor to edit server configuration files and programs for so long. Almost all Linux distributions include vi editor in default installation.

I'm new to Linux, things like save and exit in a text editor may seem for linux users as easy as not worth mentioninig.

I was put in the situation to edit a file, save and exit the program. All good, type what you want, navigate inside the file with arrows, etc. When to save, you have to do it with a combination of keys, but what combination? More, all the commands I tryed, they just apear in my file...

I searched the internet, there is nowere I cand find just that information. I have to read and compile from FAQ's, Documentations.

First, I find that the editor is VI, and there is

Command mode & Insert mode

In the insert mode, one can write, and in command mode, one can issue commands.

ESC will take one out of insert mode and return one to
command mode.

ZZ is the Exit and save command

More here: vi editor FAQ (Frequently Asked Question List), Part 1/2

Easy? After 3 hours of searching and reading on the internet is easy for me too.

2 comentarii:

Marcus spunea...

VI is one of the oldest and greatest editors out there. There are several great resources to learn. These two sites are my favorites.

http://vimcasts.org/ <-- Videos if you learn that way
http://www.vi-improved.org/ <-- Text mostly if you learn that way.

Granpapa spunea...

Thanks for the links, I will take a look.