COMP 104 Final Exam Practice 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?

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

______.

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?

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? 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?

2. In a vi session, what is the easiest way to make sure that you are in command mode?

3. What is UNIX and how do we interact with it?

4. You have forgotten some of the options for the ls command. What command can help you?

5. What are TERM and SHELL? How can you find their current values?

6. What Unix command displays your current directory? 7. In vi, what command is used to change from command mode to insert mode?

8. Assume you are in vi command mode, list two ways to save your work and exit vi.

9. Assume you are in vi command mode, how do you exit vi without saving your work?

10. When setting permissions, there are three types kinds of people. Who are they?

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.

b. You are in the bin directory under user ID chan11 and you want to go to the source directory. What command do you enter?

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?

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?

e. If you want to see the permissions and date changed on the files, what option do you add to your command?

11. You cannot remember the command to delete files. What command can you enter to get help?

12.You want to list all the files in your current directory that start with either lab1 or lab2. What command do you enter?