VI is for wimps

Thanks to Michael for reminding me of this webgem. Its about how VI, and how its wimpy to use it (obviously) for those of you not knowing VI, its an impressive editor – just a little rough for new comers and everyone grown up with something other than a command prompt as the GUI for a computer. (Alas, no fancy menus and all keyboard shortcuts), the only editor that is less new-user friendly is ED. Still VI is one of my favorite editors when dealing with config files etc. on Linux.

The page has been off the net for a while, and is archived thanks to the WayBackMachine, but since everything else is going belly up these days, I thought I would post it here too, so you know what you gotta do if you want to read it…

vi(1) is for whimps

by Jesus Monroy, Jr.

Lately, I’ve been a bit melancholy. Someone off-handedly stated (in a thread I can’t recall) that all discussion if they go on long enough end in a VI vs EMACS battle. Somehow, this just wrings with too much truth.

The UNIX kernel is bloating. ELF is popular and the words OPEN SOURCE, now have a new meaning. It’s bizarre.

None the less rather than drone on my depressions. Let’s move on.

Note that this is done with no intermediate files.

This is defintely a thing you cannot do with NT.

Tool Set

  • sh(1) – command interpreter (shell)
  • echo(1) – write arguments to the standard output
  • cat(1) – concatenate and print files
  • head(1) – display first lines of a file
  • tail(1) – display the last part of a file
  • mv(1) – move files


  1. cat -n displayes a file with line numbers.
  2. cat(1) and echo(1) are almost interchangeable. The major difference being that echo(1) requires it’s input as an arguement; where cat(1) will accept a stream.
  3. ctrl-d (^d) can be used when typing to end a stream.
  4. ctrl-v (^v) can be used when typing to inserting a literal (like ESC or ctrl-d).

    • Create File
      1. echo line > filename
      2. cat  > filename
    • Append File
      1. echo line >> filename
      2. cat  >> filename
    • Prepend to a File
      1. cat < (echo line ; tail +0 original) > newfile; mv newfile original
      2. cat > filename; cat original >> filename; mv filename original
    • Insert into a File
      1. head -n original > filename; echo line >> filename; tail -n original >> filename
      2. head -n original > filename; cat >> filename; tail -n original >> filename
    • Remove from a File
      1. If you can't figure it out, give up now.
    • Prepend to a Line –
      1. echo "prepend `(tail -n original | head -1)`" 
      2. echo -n prepend ; `(tail -n original | head -1)` ; echo 
      3. cat > filename ; echo `(tail -n original | head -1)` >> filename
    • Append to a Line
      1. echo "`(tail -n original | head -1)` append"
      2. echo -n `(tail -n original | head -1)` ; echo append
    • Remove a word
      X=`tail -n original | head -1`
      for I in ${X} ; do
      echo -n ${I};
      read Q
      if [ $Q == 'Y' ] ; then
      echo -n "${I} " >> tempfile;
      echo >> tempfile

[email protected]

Monroy &amp Associates &#169 June 22, 1999
Scroll to Top