Lab 5

Back Up Next

horizontal rule

Home
Lab 1
Lab 2
Lab 3
Lab 4
Lab 5
Lab 6
Lab 7
Lab 8
Lab 9
Lab 10
Lab 11
Lab 12
Lab 13
Lab 14
Lab 15
Lab 16
Lab 17
Lab 18
Lab 19
Lab 20

Lab 5

(Chapter 5)

 

 


 

Learning Objectives

  1. To practice editing text files in pico
  2. To practice editing text files in vi
  3. To practice editing text files in emacs

 

Lab Work

  1. Log on to your UNIX system, and execute the pico program on a new, blank file.
    1. On the first line of the file, type your first and last name.
    2. On the second line of the file, type "The pico UNIX text editor allows you to do simple editing on small text files efficiently".
    3. Use the <Ctrl-O> command to write the file to the default directory with the name lab51 .
    4. Print the file lab51 at your UNIX system line printer.
  1. If you have not done Practice Session 5.2 on pages 88 and 89 of the textbook, create the file linespaced2 using the instructions on those pages before you do this lab work exercise. After completing Practice Session 5.2, use pico to add two(2) more lines of text to the file named linespaced2 below lines 2 and 3, with similar content to lines 2 and 3. Then add a line at the top of the file with your first and last name on it. Save this new file with the name linespaced3, and print it at your UNIX system line printer.
  2. What version of pico did you use in the above work, and how did you find this out?

 

  1. Use the cat command to create a short text file named shorty on your UNIX system, and then read that file into pico, and add text to it. What command did you use to read the cat-created file into pico?

 

  1. Execute pico on your UNIX system using the –m command option. What functionality did the –m option give you in pico?

 

 

  1. Log on to your UNIX system, and execute the vi program on a new, blank file.
    1. On the first line of the file, type your first and last name.
    2. On the second line of the file, type " The vi UNIX text editor has almost all the features of a word processor and tremendous flexibility in creating text files".
    3. Print the file to your UNIX system line printer while you are still in vi. How do you accomplish this, in a non-X Window System environment?

 

  1. What vi command allows you to move to the first line in the current buffer? What command allows you to move to the last line in the buffer?

 

  1. Use the set command to force vi into a 30 column by 15 line display of characters so that one screen of the display shows only 15 lines, and text is automatically wrapped onto the next line after the 30th character. How did you do this? (Hint: The set all command shows the current status of all vi environment variables.)

 

 

  1. What file in your home directory allows you to customize your vi environment variables permanently?

 

  1. What do the following 8 vi commands do?
    1. 12dw  
    2. 5dd     
    3. 12o     
    4. 5O      
    5. c5b     
    6. d5,12  
    7. 12G    
    8. 5yy      
  1. Log on to your UNIX system, and execute the emacs program on a new, blank file, using the –nw command option.
    1. On the first line of the file, type your first and last name.
    2. On the second line of the file, type "The emacs editor is the most complex and customizable of the UNIX text editors".
    3. Print the file to your UNIX system line printer while you are still in emacs. How do you accomplish this, in a non-graphical environment?

 

 

  1. Using emacs, type in a paragraph of text from one of your favorite books, but without altering the size or shape of the emacs frame or using the Enter key, use the word wrap feature of emacs to format it exactly the way that it is printed in the book. Print the file at your UNIX system line printer.
  2. Which emacs commands move you forward and backward one character, one word, one sentence, and one paragraph?

 

 

  1. Define an emacs keyboard macro that accomplishes a common editing task for you.
  2. Similar to Practice Session 5.10 on pages 121,122 of the textbook, create, edit, compile, link and execute a short C program of your choice in emacs.
  3. Log out.

 

 


 

 

horizontal rule

Back to CS140U Homepage
This page was last modified September 26, 2004
wmorales@pcc.edu