Print
In UNIX, vi (full screen editor) are most commonly used, although there are many GUI editors.

To start editing , use vi <filename>, e.g.

umuxremote% vi test

If the file is not already existed, it is created when you save the file. Otherwise the content of the file will be retrieved for editing.

Vi has two modes of operations : a data mode and a command mode. In data mode, you can enter data from the keyboard. In command mode, the letter or combination of letters are interpreted by vi to be a command.

  • <Escape> key will switch data mode to command mode.
  • <i> or <a> key will switch command mode to data mode.

Here are some commands in the command mode,

  • h    –  moves the cursor to the left
  • j     –  moves the cursor down by 1 line
  • k    –  moves the cursor up by 1 line
  • l     –  moves the cursor to the right
  • a    –  append data after cursor (end with <Escape> key)
  • A   –  append data at end of the line
  • i     –  insert data before cursor (end with <Escape> key)
  • x    –  delete 1 character
  • dd  –  delete 1 line
  • /     –  to find a string of text

To save the file, press <:> in the command mode and then a blank line at the bottom will be waiting for you request, press w to save the file. In short, press :w to save the file. Similarly,

  • :w     save the file
  • :q      end the vi editor
  • :q!     end the vi editor without saving
  • :wq   save the file and end the vi editor