Assignment C
General instructions for all assignments
Provide an answer for each item in each session.
Number each answer with the same number as the corresponding item in the session assignment.
When the answer to the item is a Unix command, show the command and the system's response.
When the system prints more than 5 lines, abbreviate the response to 5 lines
(unless more lines are specifically requested), showing the most important parts.
Use vi to create a file for each session, for example,
create a file named sessionC1
Special instructions for Assignment C
During Assignment C you will be building a moderately large set of
directories. To keep them all organized in your work, sketch a
tree diagram of the directories and update it as you build them.
At the end of the assignment you will be required to complete
a drawing of the directory structure, which you can create from
the sketch you built as you went along.
Because you will be changing directories, it is important to
record what directory you were in when you issue a command.
This should be done in Assignment C, and in other assignmnets
dealing with multiple directories.
Do this by copying the entire prompt into your solution
of the assignment. For example for session C1 item 4.
4. [oldham@voyager letters]$ mkdir friendly formal
Session C1
- Log into the system.
- While in your home directory, make three directories named letters, reports, and assignments under
your home directory.
- Change to directory letters.
- While in the letters directory, make two directories named friendly and formal under the letters
directory.
- Change to the directory reports using only one command (directly from letters).
- While in the reports directory, make three directories named personal, business, and school under the
directory reports using only one command.
- While still in the reports directory, make a directory named UNIX under the assignments directory.
- While still in the reports directory, make three directories named HWs, projects, and
backups under the UNIX directory.
- Change to your home directory.
- While in your home directory, recursively list all of the directories you created.
Using pencil and paper, draw a tree diagram with all these files and directories.
(This sketch will be revised in Session C3.)
- You may log out, or continue with the following session.
Session C2
- Log into the system or change to your home directory.
- Change to the HWs directory.
- Check your present working directory.
- While in the HWs directory, use vi to create a file named hw3 that contains five lines,
where each line contains the name and a very short description of a Unix command.
- While in the HWs directory, use vi to create a file named other that contains one line,
containing the word hello
- Change to your home directory.
- While in your home directory, use wildcards to display
all of the files you have created under the HWs directory.
- While still in your home directory, make a copy of hw3, name it hw3.copy
and save it in the same directory where hw3 is stored (the HWs directory).
- While still in your home directory, check to see if both files (hw3 and hw3.copy) exist.
- Change to the HWs directory.
- While in the HWs directory, make a hard link to the hw3 file
with the name hw3HL in your present working directory.
- While still in the HWs directory, make a soft link to the hw3 file
with the name hw3SL in your present working directory.
- Use a command to check the inodes of hw3, hw3.copy, hw3HL, and hw3SL.
Which ones are the same? Which ones have a different inode?
Why are these inodes this way? (This response may total a maximum of 10 lines.)
- Use the ls command to
find the file types of hw3, hw3.copy, hw3HL, and hw3SL
Explain the result. (This response may total a maximum of 10 lines.)
- You may log out, or continue with the following session.
Session C3
- Log into the system or change to your home directory.
- Change to the UNIX directory.
- While in the UNIX directory, copy all your files in the HWs directory with
names beginning with hw
to the backups directory. Do all this with the one copy command.
- While still in the UNIX directory, use the find command to
check the inode numbers of all files with names starting with hw
in all the directories below the UNIX directory.
Are the inodes all the same? Are the inode numbers in the HWs directory the same as in the backups directory?
Why? (This response may total a maximum of 15 lines.)
- While still in the UNIX directory, use the find command to
make a long listing of all files with names starting with hw
in all the directories below the UNIX directory.
What is different between the hw3SL file in the HWs directory
and the hw3SL file in the backups directory? Why? (This response may total a maximum of 15 lines.)
- Change to the HWs directory.
- While in the HWs directory, delete the original hw3 that is in the HWs directory.
- While still in the HWs directory, use the command cat to look at the contents of
the file hw3SL.
- While still in the HWs directory, use the command ls -l
to look at the directory entry for the file hw3SL.
- Is hw3SL a soft link?
If it is a soft link, what does it link to?
If it is not a soft link, what is it? (This response may total a maximum of 10 lines.)
- While still in the HWs directory, copy the hw3 file from the backups directory to the HWs directory.
- While still in the HWs directory, check to see if hw3SL is now a valid soft link.
Is hw3SL a valid soft link?
- Change to your home directory.
- While in your home directory, recursively list all the files and directories you have created
in all the sessions of this assignment.
Update the tree diagram that was created in session C1, adding all new files and directories.
- You may log out, or continue with the following session.
Session C4
- Log into the system or change to your home directory.
- While in your home directory, create a very short friendly letter, named friend.1, using vi and store it under the
friendly directory.
- While still in your home directory, create a very short formal letter, named formal.1, using vi and store it under the
formal directory.
- While still in your home directory, copy the file formal.1 and call the new copy file formal.2 which is also in the formal directory.
- While still in your home directory, make a small change in formal2 using vi.
- While still in your home directory, use one command using wildcards to
print the contents of formal.1 and formal.2
(Remember that print in UNIX means print to the screen.)
- While still in your home directory, make a directory named busLetters under your home directory.
- While still in your home directory, move the formal directory (with all of its contents) into the busLetters
directory.
- Log out of the system.
Submission session
Create a heading similar to the heading for assignment A.
Tommy Atkins replace with your name
CIS 18A
Winter 2011 replace with the current quarter
Assignment C replace with the current assignment letter
- Use the following command to create a file with your work from the assignment:
cat headingC sessionC1 sessionC2 sessionC3 sessionC4 > assignmentC.txt
-
Use e-mail or WinSCP to obtain a copy of assignmentA.txt.
Print it using notepad, or otherwise use the Courier New or other mono-space font.
- Turn in your printout to the instructor on time.