CS 1440 Lab 1

Cover sheetPrevious ActivityNext Activity


Activity 1-3: Editing a file

Activity Goals

Activity Procedure

Creating and editing C++ program files does not require the many features of word processors like Microsoft Word.  The cs machine has several text editors, including pico, vile, and emacs.  Pico is the easiest to learn and so we’ll use it for awhile.  Later, you’ll learn about vile which is a little more powerful. 

Pico is not a UNIX command, but rather an application.  However, in UNIX you run applications like you give commands.  Let’s run the Pico text editor application.  Type:
      %  pico

What is displayed in your telnet window should change, perhaps significantly.  The whole window is now dedicated to the Pico application.  You’ll notice at the bottom of the screen are reminders about Pico’s commands.  Let’s exit (or quit) the application.  See it says  ^X Exit” at the bottom.  Now, ^X is a shorthand way to say “Control-X” which is typed in by holding down the Control (or Ctrl) key at the same time as the X key.  Go ahead and exit Pico.

Now that you have quit the Pico application, you should be back at the Unix prompt.  Let’s get back into Pico again, but first make sure you are in your 1440/Lab 1 directory (use pwd and cd if necessary). 

Once inside Pico, type in your name.  Try using the arrow keys.  Type in a few more words.  Use the backspace key to delete some characters.  Use the delete key.  Now let’s write this out as a file in your Lab1 directory; use the  ^O  command.  Pico will ask you what name to give the file, type in  “myfile.txt” (without the quotations) and press the Enter key.  Notice that you are still in Pico; you can continue to make changes to myfile.txt and write them out whenever you wish.  BEWARE though, what you type is not saved until you write it out.  Make a few more changes, then try to exit Pico without writing out your changes.  See what happens?  Pico will try to help you – a little.  Go ahead and save the changes and exit Pico.

Now, you should be back to the Unix prompt.  Use the ls command to see that you created a new file.

You can Pico a specfic file too.  Try:
               %  pico  myfile.txt

 

Activity Followup

Use Pico to change the file hello.C.  In that file it has two words “YOUR NAME” that you should change to be your actual name.