Name: ______CIS 52

Assignment 2

Due: March 17, Beginning of Class

1.  Create a directory in your home directory called Assignment2. Change to this directory. Using one command, create the following directories:

a.  A directory named with your first name initial (lowercase)

b.  Inside your first name initial directory, a directory named with your middle initial (also lowercase)

c.  Inside your middle initial directory, create a directory named with your last name initial (also lowercase)

For example, Justin Michael Howell would have:
/home/jhowell/Assignment2/j/m/h

What command did you use to create these three directories?

______

2.  Create the following files, either using redirection or vim, your choice.

a.  In your first initial directory, create a file MyFirst containing:
one = 1 + 0
two = 1 + one
three = two + one

b.  In your middle initial directory, create a file MySecond containing:
one * potato
two * potato
three * potato

c.  In your last initial directory, create a file MyThird containing:
one is the loneliest number
two can be as bad as one
three is one more than two

d.  Change your working directory to Assignment2. Write a command using cat that will create a file named MyFourth in your current directory that contains all the data from the files in your first, middle, and last initial directories, without using the filenames in your command.
______

e.  Write a command using cat that will create a file named MyFifth in your current directory that contains all the data from the files in your first and last initial directories, but not you middle initial directory. Do not use the filenames in your command. [hint: use metacharacters]
______

3.  Let’s make some regular expressions.

a.  Write a command line that will count the number of words in /usr/share/dict/words that contain an upper case letter A [hint: really easy. RE not necessary]
______

b.  Write a command line that will count the number of words in /usr/share/dict/words that start with an upper case letter A
______

c.  Write a command line that will count the number of words in /usr/share/dict/words that contain a double vowel (i.e., aa, ee, etc)
______

4.  Complete the vimtutor. Save the results in a file called vimtuor.done
How many lines are in the work buffer upon completion? ______

5.  Copy the file letter from /home/files into your Assignment2 directory. Open the file in vim. Use your newfound vim skills to do the following:

a.  Fill in the appropriate date in the first line.

b.  Search for the line that ends “It’s neat!” Below that line, insert a line containing the feature of Linux you find most interesting.
What was the search string you used?
______

c.  Search for the paragraph that starts with “My only …” and delete it.

d.  Replace all occurrences of “monkey” with “Linux”. Make sure to get both “monkey” and “Monkey”.
What replacement string did you use?
______

e.  Fill in your name on the last line.

f.  Save and close the file.

6.  Change to your home directory. Create a gzipped tar file that contains the Assignment2 directory and all of its contents.
What single tar command did you use?
______

7.  Determine, using the appropriate utility, how many bytes your home directory contains.
What utility did you use? ______

8.  Delete the Assignment2 directory. Leave your tarfile in your home directory, and turn in this document with your answers filled in.