CS534 Operating Systems - Lab 2 Parts 1, 2, 3, and 4

The vi Editor

Part One

  1. Using the mkdir command, create a subdirectory called cs534Lab2 under the root directory of your home directory.
  2. Use the cd command to change to the cs534Lab2 directory.
  3. Using vi, open a new file named cs534Lab2vi.txt in your cs534Lab2 directory. Type two paragraphs pertaining to the Linux File System using whatever source you like (your text will do nicely). Be sure to create as many typographical errors as you can while you are entering the paragraphs...the more the better. When complete, save the file in the current directory (cs534Lab2).
  4. Again, using vi, open cs534Lab2vi.txt, and correct errors in the document...YES, there are errors, because you put them there. When complete, save the document as cs534Lab2vi_correct.txt in your cs534Lab2 directory.
  5. Using vi, open a new file named cs534Lab2_vi_questions.txt in your cs534Lab2 directory. This file will contain the questions and the answers to the questions listed in Part Two of this exercise below. When complete, save the file in the current directory (cs534Lab2) as cs534_vi_questions.txt.

Part Two

  1. What is the name of the original UNIX system editor?
  2. How does this editor process data?
  3. What is the name of the UNIX system editor that superceded the previous editor?
  4. How do the two editors differ?
  5. What is the genesis of the term vi?
  6. What is vi optimized to do?
  7. Name two UNIX system text formatting programs.
  8. What is the difference between Command Mode and Input Mode in vi?
  9. What is the Last Line mode?
  10. List and describe the three types of input modes.
  11. What is the purpose of using the :set showmode command?
  12. What happens if you press the <ESC> key while in Input Mode?
  13. What happens if you press the <ESC> key while in Command Mode?
  14. What is displayed in the status line?
  15. What is the meaning of the tilde (~) symbol in vi?
  16. What is the function of the work buffer in vi?
  17. What is the NEWLINE character and what does it do?
  18. How do you increment and decrement numbers in a text document using vi?
  19. How large a file can vi accommodate?
  20. How does vi implement split screens?
  21. What does the command ZZ do?
  22. How can the same effect be achieved from Command Mode?
  23. What does the w key do?
  24. What does the W key do?
  25. What does the j key do?
  26. What does the k key do?
  27. What does the h key do?
  28. What does the b key do?
  29. What does the B key do?
  30. What command allows forward scrolling through the work buffer?
  31. What command allows backward scrolling through the work buffer?

Part Three

  • Use the cd command to change to the cs534Lab2 directory.
  • Using vi, open a new file named cs534Lab2_vi_history.txt in your cs534Lab2 directory. Enter the following paragraph EXACTLY AS SHOWN.
·                 
The History of vi
The vi editor was developed at the University of california
berkeley as part of the berkeley unix system.
At the beginning, the vi editor was part of another editor.
The vi part of the ex editor was often used and became very.
This popularity forced the developers to come up with a separate
vi editor.
now thee vi editor is
independent of the ex editor and is availabe on
most of the UNIX operating system.
The vi editor is a good editor for everyday editing jobs.
  • When complete, save the file in the current directory (cs534Lab2) and close the document
  • While still in the cs534Lab2 directory, make a copy of cs534Lab2_vi_history.txt and name it cs534Lab2_vi_historyold.txt
  • Again, using vi, open cs534Lab2_vi_history.txt, and edit the document (please DO NOT RETYPE the document) so that it looks exactly like the paragraph below.
The History of vi
 
The vi editor was developed at the University of California
Berkeley as part of the Berkeley UNIX system.
At the beginning, the vi (visual) editor was part of the ex editor,
and a system user had to be in the ex editor to launch the vi editor.
 
The vi part of the ex editor was often used and became very
popular. This popularity forced the developers to come up
with a separate vi editor.
 
Now thw vi editor is independent of the ex editor and is availabe
on most UNIX operating system distributions.
 
The vi editor is a good, effecient editor for everyday editing jobs,
although its structure could be less cryptic and
the instructions more intuitive.

·        When editing is complete, save the document as cs534Lab2_vi_history.txt in your cs534Lab2 directory.

Part Four

·        Use the cd command to change to the cs534Lab2 directory.

·        Using vi, open a new file named cs534Lab2_vi_gardening.txt in your cs534Lab2 directory. Enter the following paragraph EXACTLY AS SHOWN.

An Approach to gardening
Everywhere the trend is toward a simpler, and easy to care
garden. Few advises might help you to have less trouble with
your gardening. I am sure you have heard them before, but
listen once more. Gardening: The easy approach
visit the plant nuseries, it is good for your soul.
Let me tell you that There is no easy to care garden.
Use plants that are suitable for your climate. Native plants
are good CHOICE. Before planting, choose the right site. Use your
imagination, plants grow faster than you think.
Gardening can be made easier and more enjoyable
if you hire a gardener to do the job. Use mulches to reduce weeds
and save time in watering plants. Do not use too much chemicals to
kill every weed insight. You are the only one who sees the weeds, let them
grow. They keep the moisture and reduce soil erosion.

·        When complete, save the file in the current directory (cs534Lab2) and close the document.

·        While still in the cs534Lab2 directory, make a copy of cs534Lab2_vi_gardening.txt and name it cs534Lab2_vi_gardening_old.txt

·        Again, using vi, open cs534Lab2_vi_gardening.txt, and edit the document (again, please DO NOT RETYPE the document) using cut-paste features, line numbering features, etc., so that it looks exactly like the paragraph below.

 
Gardening: The Easy Approach
Everywhere the trend is toward a simpler, and easier-to-care for
gardens.
However, let me tell you that there are no easy-to-care for gardens.
Gardening can be made easier and more enjoyable if you hire a gardener
to help you do the job.
Some advice might help you to have less trouble with your gardening.
I am sure you have heard it before, but listen once more:
 
1.       Before planting, choose the right site. 
2.       Use your imagination; plants grow faster than you think.
3 .      Visit the plant nurseries; it is good for your soul.
4.       Use mulches to reduce weeds and save time in watering.
3.             Use plants that are suitable for your climate. 
4.             Native plants are good choice. 
5.             Do not use enough chemicals to try to kill every weed insight.
6.             You are probably the only one who sees the weeds.
7.             Let them grow. 
8.             They keep moisture in the ground and help prevent soil erosion.
 

When editing is complete, save the document as cs534Lab2_vi_gardening.txt in your cs534Lab2 directory.

 Create a tarball (a gzipped tar file) named cs534_yourfirstname_yourlastname_cs534Lab2.tgz in your cs534Lab2 directory. The archive will include ALL of the files contained in your cs534Lab2 directory.

 

             Use the following command to create the tarball: tar cvzf filname.tgz *

 

            Remember that there must be a space character between the z in .tgz, and the * (asterisk).

NOTE 1: A dash (-) preceding the options to the tar command IS NOT REQUIRED. Including the dash will not hurt...it just won't add any functionality.

NOTE 2: The order of the options given to the tar command is important. The c MUST be first and the f MUST be last.

NOTE 3: It will be helpful to be IN the cs534Lab2 directory when you create the tarball...if not, you'll have to provide a path to the files that will be included in the tarball.

At the appropriate time you will be instructed on how to deliver the lab to the instructor for evaluation whether you are working in the lab or at home.