Tutorial 4

 

In this tutorial, we are going to exercise our knowledge on editors. The UNIX machines available to use are cs1 to cs3 at utdallas.edu.

 

You can use either putty or Xmanager to access these UNIX machines.

 

For detail instructions on login, please refer back to Tutorial 1.

 

Editors

 

In UNIX, there are three popular editors, whose names are listed below with a link to a simple tutorial for each:

 

  1. Pico: http://www.usd.edu/trio/tut/pico/

     

    1.1 Open a Pico file:

     

    1.2 Edit the file:

     

    1.3 Save by typing "ctrl + O":

     

    1.4 Exit by typing "ctrl + X":

 

        Go through the Pico tutorial. Following the instructions, open a file and edit the body text. Change the body to whatever you want.

        Save the file and exit.

  1. Vi/Vim: http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Editors/ViIntro.html

     

    "vi" has two modes for editing, i.e., editing mode and command mode. When "vi" is launched, it is in the command mode, which means that you can move the cursor, delete a line or character, but not inserting. The insertion of a character is in the editing mode. By pressing the "Esc" key "vi" can switch from the editing mode to the command mode, and there are various ways to switch from the command mode to the editing mode (please refer to the link above).

     

    2.1 Open the "pico_example.pico" file using vi:

     

    2.2 Shift the cursor to the end of the first line by pressing "Shift + $" following pressing "Esc":

     

    2.3 Change to the next line by pressing "a" followed by pressing "Enter". By pressing "a", the "vi" editor's mode is changed from the command mode to the editing mode, and at the same time cursor moves to the next position adjacent to the current position on the screen.

     

     

    2.4 Typing in the sentence as follows:

     

    2.5 Saving by pressing "Esc" and typing ": + w" (":" followed by "w"), and pressing "Enter". By pressing "Esc", "vi" editor's mode is changed from the editing mode to the command mode, where you can perform the saving operation. After typing ":", the command line on the bottom of the screen shows and you can actually issue command in "vi" editor. By typing "w" followed by pressing "Enter", you are saving the file with the name "pico_example.pico".

     

    2.6 Exit by pressing ": + q", then "Enter":

 

        Go through the "vi" tutorial. Following the instructions, open a file and edit the body text. Change the body to whatever you want.

        Save the file and exit.

  1. Emacs: https://cms.amherst.edu/offices/it/help/software/unix/emacs

     

    3.1 Open the "pico_example.pico" file using emacs:

     

    3.2 Move the cursor using Left, Right, Up and Down arrow:

     

    3.3 Typing in the third line as follows:

     

    3.4 Exiting emacs by typing "ctrl + x" followed by "ctrl + c":

     

    3.5 Enter "y" to save:

 

        Go through the Emacs tutorial. Following the instructions, open a file and edit the body text. Change the body to whatever you want.

        Save the file and exit.