| |
Commands, Utilities, and pathnames
Due: end of Friday lab
"Review questions" refers to the review questions at the back of each chapter
in the textbook. Unless stated otherwise, "all questions" means "all review
questions, including the advanced review questions".
The printed answers to this problem set must be submitted to your lab instructor at the
end of your lab period on Friday. You may use any text editor or word processor you
like to create the printed copy. Your instructor can show you some basic Unix GUI
editors and how to print from each editor.
Chapter 3
Read Chapter 3 and answer these questions:
- Review questions: all
- What is the difference, if any, between these Unix pathnames?
Could they refer to different files?
.profile
./.profile
././././.profile
If "data" is a subdirectory of the current
directory, then what are the
differences, if any, among the following commands?
$ ls data/..
$ ls .
$ ls
If you were to change your PATH environment variable to contain the following imaginary
directory names:
$ PATH=/happy/groundhog/day:/recycling/rules
In which directories would the shell look for the imaginary "zoot"
command if you type the following command lines:
$ zoot
$ ./zoot
$ subdirectory/zoot
$ /sbin/zoot
$ ../zoot
For each of the five command lines, give all the possible places the shell would try to
find the "zoot" command.
What single Unix commands would you use to:
| change to your home directory |
| display the list of files in the current directory |
| display "my name is fred" onto the screen |
| put the file "tmp.dat" in the current directory down into the directory
"data" underneath your home directory, leaving a copy behind in your current
directory? (Both the current directory and the "data" subdirectory each have a
separate copy of the file.) |
| put the file "tmp.dat" in the current directory down into the directory
"data" underneath your home directory, without leaving a copy behind in your
current directory? (After the command, the file will only exist in the "data"
subdirectory.) |
A Unix user has created a file called "-tmp", with a
leading dash. (The command "cp .profile -tmp"
will do it.) They now want to get rid of this file. Why might the user have difficulty
removing this file? (Create this file and try it yourself.) How would you remove the file?
How many records are in the Unix password file ("/etc/passwd")
on your computer? (Helpful hint: "man wc".) How
many fields does each record contain?
What is stored in the second field of every record in the Unix password file?
Print and submit your answers to the lab instructor by the given due date and time.
|