Beginner's Tutorial for vi console text editor
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4076
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Here's a nice little tutorial for those of you who want to start learning how to use vi, the classic Unix text editor. Other text editors are a bit easier to use, like nano, which is based on pico I believe, but vi and emacs are the preference of most unix/linux power users, so it's not a bad idea to get at least a working knowledge of these tools.

Starting vi is easy, but of course once you start it, there's nothing there. You have to tell it what you want to do, say you want to open a file called 'about.conf'. In the command terminal, or console, just type in this command:

:: Code ::
vi about.conf

That's assuming you're already in the directory that contains about.conf, otherwise you'd type in the whole path to it.

:: Quote ::
Common Vi Commands

Press Key(s):* Function:
I Insert text before the cursor
A Insert text after the cursor
: Switch to ex mode
$ Go to last place on the line
^ Go to first place on the line
W Next word
B Previous word
Shift-G Last line of the file
20 Shift-G Go to line 20
Y Copy. (Note: Y3W = copy 3 words; Y3J = copy 4 lines.)
P Paste
D Cut
X Delete character under the cursor

* Note: Only capitalize letters preceded by "Shift-".

Back to top
Display posts from previous:   

All times are GMT - 8 Hours