Using vi to Edit Text Files#

Even the simplest administration tasks can be very difficult for technicians without UNIX experience. The reason? Editing a text file can be frustrating and time consuming if one has not yet been familiarized with an available text editor. One of the most commonly used and available: vi. vi is elegantly simple, but brutally non-intuitive.

As daunting as it may seem, there are just 10 key combination to remember when editing text files on a server via SSH. Of course there are more for advanced functions... but you really only need these:

unconditionally quit (like when you really mess up and want to start over)
Arrow keys
moves the cursor up, down, left, right (make sure you are not in INSERT mode!)
enters INSERT mode, text typed will be placed at the cursor; press ESC to exit INSERT mode
inserts a blank line after current line, enters INSERT mode; press ESC to exit INSERT mode
jumps to the end of the current line to APPEND text to the line; press ESC to exit APPEND mode
deletes the character at the cursor
replaces the character at the cursor with p
deletes the entire line that the cursor is on
search for the next occurrence of something
save changes and exit

NOTE: As with everything in UNIX, the commands are case sensitive.

VI Quick Help#

VI Quick Advanced Help#

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-5) was last changed on 26-Jul-2009 10:31 by jim