AnswersPE

advertisement
COMP 104 Final Exam
(Unless stated otherwise, assume that your current directory is your home directory.)
1. You and two friends are taking Comp 110. You have decided that Franklin is
such an honest place that you will allow everyone to read, write and execute
your files.
a. What command do you enter so that everyone can read, write and execute
all the files that you create in the current session?
umask 000
b. You have two choices so that you always create files so everyone can read
them – remember to put the command above in every time you login or
- put the command in the .profile file that is executed when your shell starts.
____________________________________________________________.
c. About a week later, one of your friends says that one of his/her files was
written over by another student. You decide to remove write permissions
for everyone but yourself from all files that you create. What command
do you enter?
umask 022
d. You previously create a file called LAB1 in your home directory. Did the
command above protect it? If not, what command do you need to enter to
remove write permissions?
-- No, it did not protect it.
chmod 755 LAB1
e. Another week passes. Your second friend says that that he is in trouble.
Someone copied his lab, but he cannot prove that the other person did the
copying. You decide to remove read permission and execute permission for
all the other students, but your instructor must have read and execute to grade
your lab. What command do you use?
umask 072
2. In a vi session, what is the easiest way to make sure that you are in command
mode?
-- hit ESC <escape> once or twice
3. What is UNIX and how do we interact with it?
-- UNIX is an operating system. We interact with in use a command line
interface (or character user interface).
4. You have forgotten some of the options for the ls command. What command can
help you?
man ls

5. What are TERM and SHELL? How can you find their current values?
-- They are shell variables. –echo $TERM and echo $SHELL
6. What Unix command displays your current directory?
pwd
7. In vi, what command is used to change from command mode to insert mode?
the single character ‘i’
8. Assume you are in vi command mode, list two ways to save your work and exit
vi.
ZZ or :wq
9. Assume you are in vi command mode, how do you exit vi without saving your
work?
:q!
10. When setting permissions, there are three types kinds of people. Who are they?
The owner of the file, the group that includes the owner; and everyone else.
Your book says that everyone else includes the owner and the members of the
group. THIS IS NOT TRUE.
11. A Unix systems has the following directories: root with its subdirectories home,
bin, etc, and usr. The home directory has subdirectories for user ID’s jones04,
lee05, smith23, and chan11. Each user ID has subdirectories bin and source.
a. Draw the directory tree using either of the diagram methods that we learned.
-- root
_________________________________________________________
|
|
|
|
home
bin
etc
usr
|_________________________________________________
|
|
|
|
jones04
lee05
smith23
chan11
/
\
/ \
/
\
/
\
bin source bin source
bin source bin source
- root
b.
|----home --------------------|
|----bin
|
|
|
|
|
|
|
|----etc
|
|
|----usr
|----bin
| -----jones 04 ---------|
|
|----source
|
|-----lee05---------------|----bin
|
|
|
|----source
|
|-------smith23----------|----bin
|
|
|
|----source
|
|
|-------chan11-----------|----bin
|
|----source
You are in the bin directory under user ID chan11 and you want to go to
the source directory. What command do you enter?
cd ../source
c.
You are in the bin directory under user ID chan11 and you want to go to
the bin directory under user ID jones04. What command do you enter?
cd ../../jones04/bin
d.
You are in the bin directory under user ID chan11 and you want to display
all the files in the source directory under user ID smith23. What
command do you enter?
ls –a ../../smith23/source
e.
If you want to see the permissions and date changed on the files, what
option do you add to your command?
ls –al ../../smith23/source
11. You cannot remember the command to delete files. What command can you enter
to get help?
man –k remove or apropos remove
12.You want to list all the files in your current directory that start with either lab1 or
lab2. What command do you enter?
ls –a lab[1,2]*
Download