CSCI 3291 (Current Topics -- Unix System Administration), Fall 2004:
Homework 1
- Assigned:
- September 27, 2004.
- Due:
- October 4, 2004, at 5pm.
- Credit:
- 40 points.
Be sure you have read chapters 1, 4, and 5 in the textbook.
Answer the following questions. You may write out your answers by
hand or using a word processor or other program, but please submit
hard copy, either in class or in my mailbox in the department office.
Answers to most questions will involve experimentation on
a Unix or Linux system. You are free to use any appropriate system;
if you use something other than Fedora Core Linux please tell me what.
- (10 points)
From its behavior, bash appears to maintain some
sort of command history for each user,
which is retained from one login
to the next. Where does it keep this history?
How many commands are saved?
(The answer to one or both questions might be ``it
depends'', in which case tell me what it depends on
and whether/how you could change it.)
(Hint: Read the appropriate man page.)
- (10 points)
A friend tells you that there are man pages
available for all the common C library functions.
But when you type man printf, you get a man
page describing what seems to be a shell command rather
than a function. Is there also a man page for
the C function? If so, how do you read it?
- (10 points)
Suppose you have a directory foo
that currently only you can
access (for reading, writing, etc.). How could you make
foo and all its subdirectories (and their
subdirectories, etc.) read-accessible to all users,
without changing more permissions than you need to
(i.e., no fair just giving all the files and directories
permissions of 777)?
(Hint: With the GNU version of the appropriate
command, this can be done with a single command. You
might need to read the info page to find all
the appropriate options.)
Do the following programming problem. Turn in your code
(shell script) by sending mail
to bmassing@cs.trinity.edu, with your script as an
attachment. Please use a subject line that mentions the course
and the assignment (e.g., ``csci 3291 homework 1'').
You can develop your script
on any system that provides the needed functionality, but
I will test it on one of the department's Fedora Core 2 machines,
so you should probably make sure it works in that environment before
turning it in.
- (10 points)
Write a shell script that takes one command-line argument,
a username, and prints the number of processes owned
by that username. (The script should do something reasonable
if no argument is supplied -- either print an error message
or print the total number of processes in the system.)
Berna Massingill
2004-09-29