CS 497C - Quiz 1 - Name:_________________ Date: Wednesday, September 19 (in class) Part 1: (48 points - 4 points for each problem) (2) 1. The ls command displays the contents of the files in your directory. (1) true (2) false (4) 2. The correct unix command to display the contents of a file is (1) cat (2) more (3) less (4) all of the above (3) 3. What is the correct command to end a script file? (1) Ctrl-z (2) Ctrl-q (3) Ctrl-d (4) Ctrl-l (1) 4. What is the command to suspend a job? (1) Ctrl-z (2) Ctrl-q (3) Ctrl-d (4) Ctrl-l (2) 5. Where is the password stored? (1) /etc/passwd (2) /etc/shadow (3) /etc/group (3) 6. Which one shows the name of the operating system? (1) uname -n (2) uname -r (3) uname (4) uname -m (2) 7. If you don't have the apropos command on your system, which command can you use? (1) man -l (2) man -k (3) man -f (4) man -c (2) 8. Which command is used to count lines, words, and characters in a file? (1) bc (2) wc (3) cp (4) mv (4) 9. Which command is used to check your current directory? (1) dd (2) cd (3) ld (4) pwd (3) 10. How do you abort an editing session in vi? (1) :e! (2) :w! (3) :q! (4) :z! (4) 11. Your screen shows junk in vi. How do you clear it? (1) Ctrl-z (2) Ctrl-q (3) Ctrl-d (4) Ctrl-l (1) 12. How do you delete text from the current line to the beginning of the file in vi? (1) d1G (2) 10dd (3) d$ (4) df. Part 2: (52 points) 1. List three different operating systems. (6 points) Ans: UNIX, Windows, Mac OS 2. List three commands that you can use to log out of the system. (6 points) Ans: Ctrl-d, logout, exit 3. Describe the functions of the kernel and the shell. (6 points) Ans: The kernel interacts with the machine's hardware. The shell interacts with the user. 4. How can you save the output of the who, date, and cal in a single file? (5 points) Ans: (who; date; cal) > filename 5. What is PATH? (6 points) Ans: PATH is a system variable which stores a lists of directories that the shell searches to locate a command. 6. Write the command to display the current date in the form dd/mm/yyyy. (5 points) Ans: Use date +%d/%m/%Y, date +"%d/%m/%Y", date +/%d/%m/20%y, or date +"/%d/%m/20%y". 7. How do you use bc to find out the hexadecimal equivalent of a binary number 1101001? (6 points) Ans: ibase = 2 obase = 16 1101001 8. Name three ways of quitting vi in addition to saving the file. (6 points) Ans: Use the command :x, :wq, or ZZ to save and quit the editor. 9. Summarize the three modes in which vi works. (6 points) Ans: Command mode - where keys are used as commands to act on text. Input mode - where any key depressed is entered as text. Last Line mode or ex mode - where commands can be entered in the last line of the screen to act on text.