jfw - computing consulting    
    Personal & Professional   Helpdesk    
Computer Systems Professional since 1978
Troubleshooting / Think Tank / Programming
Computer   Emergency   Response
fax: (Belgium, +32)-58-243730 // phone: (Belgium, +32) 58-243036 // email: jfw@rp-plus.de
Editing Files in Linux / UNIX
Last modified: December, 26, 2229 GMT

Althrough my tips I mention "edit this file and type...".

I know that's somehow difficult if you have no experience using editors in Linux/Unix.

But since there is a WORDSTAR workalike, and WORDSTAR itself is availabe,
AND WordPerfect is just made availabe and and and...
   it might be not SO difficult as it was before.

If you want a detailed description, decide which editor you wanna use,
then refer to the documentation.

The world's most popular editor "vi" is STANDARD, almost everywhere availabe (even in DOS),
and that's one reason why 
   FIRST   I use it,
   SECOND  I try to tell you a few things how to use it.

       ONLY a few things !!

       You won't remember the rest anyway, unless you really use it every day.

It's not so difficult after all.

To edit the file "~/XTerm" (which is in YOUR home directory, hence the "~"),
type "vi XTerm" and hit ENTER.

You are in "command mode" now.
The other mode is "insert" or let's say "edit" mode.
 (To toggle between these two modes hit ESCape on your keyboard.)

Hit "i" on your keyboard.
This tells VI, that you want to Insert something.

Type away.

Move up and down with the arrow-keys or "Page Up" / "Page Down",
move back and forth with the arrow-keys too.

To correct mistakes you can use the DEL key on your keyboard.
  (You can even use the INSERT key instead of the "i",
   but this is an undocumented feature and might not be available on your system.)

To correct mistakes you can also use the BACKSPACE key on your keyboard.
 (Above the ENTER key.)
Note that backspace is destructive.
 Don't panic - the backspace-key behaves different on different systems
 and in different programs.
 It might not mean a thing to you unless you expect the backspace key
 not to erase what's before the cursor.

To insert a new line, go to the end of the previous line:
 Use the arrow-keys to get to the line, hit END on your keyboard,
 or move to the end using the arrow-key.
 This gets you to the last character of that line, NOT BEHIND IT.
 So use the arrow-key again to get behind that character.
 If you hear a beep, hit "i" to get back to Insert mode and try again.
 Now the cursor is behind the last character of the previous line.
    That means, the cursor is - somehow (!) - on the end-of-line mark.
    Unlike DOS, UNIX uses only ONE "control-character" to mark the end of a line.
      DOS/Windows and all this stuff uses TWO,
      "carriage return"
        (like on an old mechanic typewriter, you move the paper to the left)
      and "line feed"
        (which moves the paper one line down).
    If you encounter a DOS/Windows text-file in Linux/UNIX, you might see "^M"
    at the end of the lines.
    This is the (obsolete) additional character.
      Even if these are your first steps into a new computing world,
      you might have already seen the "^M" - sequence in modem-commands.
      Since the sequence originates from hitting the ENTER key on a DOS-PC,
      it means ENTER in modem-command lines.
 Now you have a new line to type into.

To delete an entire line, move the cursor to the beginning of that line,
hit ESC to get to "command mode" and hit the letter "D" on your keyboard TWICE.
 You should not sip a coffee between the first hit on "D" and the second one.
 You should also not hit "D" more than TWICE.

To UNDO that (and any "last change") go to "command mode" by hitting ESC,
than hit the letter "U" on your keyboard.

To quit VI, go to command mode and hit ":" and the letter "Q".
 ":wq" Writes and Quits.
 ":q!" Quits without writing a changed file to disk.
 ":q"  Quits if you haven't change the file.
     (Don't worry - VI will tell you if you type something wrong.)

 I think that's enough to get you started.
 More will just confuse you, and you'll forget it anyway,
 and you can always read a lot of stuff typing "man vi" (on the system's command line).

 ESC toggles between "insert mode" (or "edit mode" or whatever you name it)
             and "command mode".

 There is NO PROBLEM if you don't know in which mode you are,
  "ESC" does not destroy anything.
  The worst case is that the machine beeps to tell you, you are already in command mode.

 In command mode "I" enables you to Insert stuff.

 In command mode "D" "D" Deletes the current line.

 In command mode "U" means UNDO.

 Going to to the end of a line, one step more to the right, and hitting ENTER
  let's you insert a new line.


That's all.
If you want to know more, you'll visit the MANual page for VI anyway ("man vi").

   and lemme know if I made a mistake here.