------------------------ Quick Quiz #1 (no marks) ------------------------ This quiz is not worth any marks. It's a self-evaluation survey to see if you understand the course material presented so far. Answers will be posted later. A. Take the PC number of the workstation at which you are now sitting - a number between 01 and 30 - and multiply it by five (5), giving a number between 5 and 150. B. Copy and edit this file to remove all questions except that question number and the four following questions (a total of five questions). Everyone will have a different set of five questions. Remove all the other questions. C. Edit the file of five questions and type the answer to each question under the question, e.g. you would add "answer: a" after question 1. Answer the question without using the computer to check your results. You won't have a computer (or your notes) for the midterm test. Answer based on your own knowledge. D. Add your assignment label to the top of the file of five questions and answers. E. Submit your file of five questions and answers using "netsubmit 84 quiz.txt". Make sure you use the exact number 84 and the file name "quiz.txt". ------------------------------------------------------------------------------ 1. If file foo contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: cat foo foo | sort -r | head -5 | tail -1 a. 7 c. 9 e. 8 b. 6 d. 5 2. What is the output on your screen of this sequence of this command sequence: echo hi >hi ; head hi >hi ; wc hi a. 1 1 3 hi d. no output on screen b. 0 0 0 hi e. 1 1 2 hi c. 2 2 4 hi 3. If I am in my home directory named /home/myhome and dir is an empty sub- directory, what is true after this command line: touch new ; mv ./dir/../new ../myhome/old a. the command fails because the path ./dir/../new does not exist b. the parent directory of dir now has a file named old in it c. the command fails because the path ../myhome/old does not exist d. the directory dir now contains only a file named old e. there is a second copy of the file new in the file named old 4. How many command arguments does the shell pass to this echo command: echo 1 2 3 4 >5 a. 3 c. 7 e. 6 b. 5 d. 4 5. When doing an ls -a, the output pathname that is a double dot (..) signifies what? a. The root directory. b. A hidden text file. c. The current directory. d. The parent directory. e. A file or directory with double links. 6. Which command pipeline outputs the count of the number of manual page titles that contain the keyword "sort"? a. wc man sort c. man sort ; wc e. man -k sort | wc b. wc -k sort d. man sort | wc 7. If /etc/passwd is a file name, which pathname always leads to the same file? a. /./../etc/./passwd d. ././etc/passwd b. /etc/passwd/./. e. /etc/../../passwd c. /etc/passwd/../.. 8. What is the output on your screen of this shell command line in an empty directory? ls * a. no output on screen b. * c. . .. d. an error message from ls saying * does not exist e. . 9. What would you see if you typed this command: cat /users a. The contents of the file users located in your home directory b. The contents of the file users located in the parent directory c. The contents of your subdirectory named users d. The contents of the file users located in the root directory e. The contents of your directory named users 10. Which command line takes the list of users currently logged in to the machine and displays just the one line containing the userid that sorts first in the alphabet? a. who | sort -r | tail -1 d. head -1 sort who b. head -1 who | sort e. sort | who | head -1 c. sort who | tail -1 11. Which of the command lines below can generate a non-empty file? a. grep pattern file >file d. head -1 file >file b. ls -l file >file e. cat file >file c. sort -r file >file 12. In an empty directory, how many words are in file out after this bash shell command line? touch a ; ls >out a. 2 d. no output (empty file) b. 1 e. 3 c. 4 13. Which of the following VI/VIM key sequences will move the entire line on which the cursor resides to after the line that follows it (i.e. it would move line 5 to be line 6 and line 6 would become line 5)? a. ddp c. DDp e. :dp b. ddP d. DDP 14. What is in file two after running this command line? echo one >two three four a. echo one d. one b. empty file (no data) e. one three four c. three four 15. Which command pipeline outputs the count of the number of pathnames (including all subdirectories) that lie under the /etc directory? a. find /etc | wc c. ls /etc ; wc e. ls /etc | wc b. man /etc ; wc d. dir /etc | count 16. Given an existing file of yours named wc, what is the output on your screen of this sequence of three shell commands: echo hi >wc ; sort wc >wc ; cat wc a. no output on screen d. 0 0 0 wc b. 1 1 3 wc e. 1 1 2 wc c. 2 2 4 wc 17. What is in the file x after this command sequence: echo foo >a ; rm b ; echo bar >>b ; cp a b >x a. foo followed by bar b. no such file (nonexistent) c. nothing - empty file - no data d. foo e. bar 18. If /bin/bash is a file name, which pathname always leads to the same file? a. /bin/../bash c. /bin/bash/.. e. /../../bin/bash b. /bin/bash/. d. ./bin/bash 19. What appears on your screen after this bash shell command line? echo hi >out | wc -c a. 1 d. no output on screen b. 3 e. 2 c. 0 20. Which of the following statements is true about this shell command line: >/a/b/c cat /a/b/d a. The command cat sees two arguments. b. The command cat sees only one argument. c. The command /a/b/c sees two arguments. d. The command /a/b/c sees only one argument e. The command is always invalid. 21. What is in file out after running this bash shell command line? echo 2 3 >out 3 0 a. 2 3 >out 3 0 d. 2 3 3 0 b. 2 3 e. 2 3 0 c. no output (empty file) 22. If file nine contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: sort nine nine nine | tail -3 | head -1 a. 7 7 7 c. 7 e. 8 b. 1 1 1 d. 9 23. What is the output on your screen of this shell command line in an empty directory? touch 1 2 3 .a .b .c ; echo .??* a. . .. .a .b .c b. . .. 1 2 3 .a .b .c c. an error message from echo saying .??* does not exist d. .??* e. .a .b .c 24. What appears on your screen after this bash shell command line? echo hi >ls ; cat ls > wc a. no output on screen d. 1 1 2 b. ls e. 1 1 3 c. hi 25. If file ten contains 10 lines, and file twenty contains 20 lines, then how many lines are output on your screen by this command: cat twenty | sort ten a. 30 d. 20 b. 60 e. no lines (no output) c. 10 26. If my current directory is /home, which of these pathnames is equivalent to the pathname /home/a/b/c? a. ./home/a/b/c c. /a/b/c e. ./a/b/c b. ../home/b/c d. ../a/b/c 27. What would you see if you typed this command: cat /users a. The contents of the file users located in your home directory b. The contents of your subdirectory named users c. The contents of the file users located in the root directory d. The contents of the file users located in the parent directory e. The contents of your directory named users 28. How many lines are in the file bar after this command line: echo hi >x ; echo ho >>x ; cat x >bar a. 4 b. 6 c. nothing - empty file - no data d. 2 e. 1 29. What is in file out after running this bash shell command line? echo a >out b c a. b c d. a b c b. no output on screen e. echo a c. a 30. Which command pipeline outputs the count of the number of pathnames that lie under the current directory and recursively under all its subdirectories? a. ls . | wc c. ls / | wc e. dir / | wc b. file . | wc d. find . | wc 31. If cow is a sub-directory that contains only the file dog, what happens after this command: mv cow/dog cow/././cat a. there is a second copy of the file dog in the file named cat b. the command fails because the name cow/././cat does not exist c. the directory cow is now empty d. the command fails because the name cat does not exist e. the directory cow now contains only a file named cat 32. If /etc/passwd is a file name, which pathname always leads to the same file? a. /../etc/passwd d. ./etc/passwd b. /etc/../../passwd e. /etc/passwd/. c. /etc/passwd/../.. 33. Which of the following statements is true about this shell command line: >bar zoom bar haven a. The command zoom sees three arguments. b. The command bar sees three arguments. c. The command zoom sees two arguments. d. Error: The command name is missing from the command line. e. The command bar sees only two arguments 34. How many lines are in the file out after this command sequence: echo hi >out ; echo ho >out ; cat out out >out a. nothing - empty file - no data b. 1 c. 3 d. 2 e. 6 35. What is the output on your screen of this shell command line in an empty directory? touch .a .b .c ; echo .??* a. .a .b .c b. . .. .a .b .c c. an error message from echo saying .??* does not exist d. no output on screen e. .??* 36. What appears on your screen after this command line? mkdir xx ; rmdir xx | wc -c a. 0 d. 3 b. no output on screen e. 2 c. 1 37. If file nine contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: sort nine nine nine | tail -3 | head -1 a. 9 c. 7 7 7 e. 7 b. 1 1 1 d. 8 38. Which of the following shell command lines displays only the names in the current directory that are exactly three alphabetic letters long? a. echo [a-zA-Z][a-zA-Z][a-zA-Z] d. echo [0-3][0-3][0-3] b. echo ??? e. echo *** c. echo [?][?][?] 39. How many lines are in file out after this bash shell command line? echo hi >dog >cat >out a. 3 b. no such file (file does not exist) c. 1 d. nothing - empty file - no data e. 2 40. How can you ask the bash (Linux) shell to complete commands or file names for you? a. Type [CONTROL]-[ALT]-[DEL] and the shell will present a menu of commands. b. You can type the first part of the command or file name and press the TAB key. c. Type [ALT]-[F2] the shell will present a menu of commands. d. Type [CONTROL]-[D] and the shell will present a menu of commands. e. You can type the first part of the command or file name and press the ALT key. 41. What appears on your screen after this bash shell command line? echo hi >a ; ls a > wc a. 3 d. 2 b. 1 1 3 e. 1 1 2 c. no output on screen 42. If you type the command sort verybigfile >out which of the following key sequences will interrupt it and take you immediately back to the command prompt? a. [CTRL-U] c. [CTRL-C] e. [CTRL-R] b. [CTRL-D] d. [CTRL-L] 43. Which command line finds all possible utilities available for compiling programs? a. man compile d. grep compile /etc/* b. apropos compile e. grep /etc/* compile c. man * | grep compile 44. If file foo contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: cat foo foo | sort -r | head -4 | tail -1 a. 7 c. 8 e. 9 b. 5 d. 6 45. Which of these command lines will make file cow contain all of the content of file one followed by all of the content of file two? a. mv one two >cow d. echo one two >cow b. cat one two >cow e. cp one two >cow c. cp one >cow two >cow 46. How many command arguments does the shell pass to this echo command: echo one two three >four five a. Three arguments. c. Two arguments. e. Five arguments. b. Four arguments. d. Six arguments. 47. In an empty directory, how many words are in file pig after this command line? touch pig pig ; ls >pig a. empty file (no data) d. 3 b. 1 e. 2 c. 4 48. Which command line below never shows any lines from inside the file cow? a. grep pattern cow c. head -1 cow e. wc -l cow b. sort -r cow d. tail -8 cow 49. What appears on your screen after this command line? echo hi >ls ; cat ls >wc a. ls d. hi b. no output on screen e. 1 1 3 c. 1 1 2 50. In an empty directory, how many arguments are passed to the cat command in this bash command line? date >a1 ; touch a2 ba ca ; cat a* a. 1 c. none e. 3 b. 4 d. 2 51. What is in the file cow after this command line: echo a >a ; echo b >b ; mv a b >cow a. a b. a followed by b c. b d. nothing - empty file - no data e. no such file (nonexistent) 52. What appears on your screen after this bash shell command line? echo cow | wc a. 1 1 3 d. 3 1 1 b. 1 1 4 e. no output on screen c. 1 3 1 53. What is the output on your screen of this command sequence: echo bat >one ; echo sky | head -2 one a. sky d. bat followed by sky b. sky followed by bat e. an error message c. bat 54. If I am in my home directory named /home/ian and mt is an empty sub- directory, what is true after this command line: touch ../ian/cat ; cp ./mt/../cat ./mt/../dog a. the directory mt now has a file named dog in it b. the directory mt now contains two files c. the directory mt is still empty d. the file named cat is now renamed to be dog e. the command fails because the path ./mt/../cat does not exist 55. Which command sequence below outputs only lines 5-10 of the file named foo? a. head -5 foo | tail -10 d. tail -15 foo | head -5 b. head -10 foo | tail -6 e. head -15 foo | tail -5 c. tail -10 foo | head -6 56. What is the output on your screen of this successful command sequence? cd /home/dir ; mkdir one ; mkdir two ; pwd a. /two d. /home/dir/one b. /home/dir/two e. /home/dir/one/two c. /home/dir 57. How many lines are in the file out after this command sequence: echo hi >x ; echo ho >x ; cat x x x >out a. 1 b. 6 c. 3 d. 2 e. nothing - empty file - no data 58. If file foo contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: cat foo foo | cat | tail -5 | head -1 a. 6 c. 5 e. 8 b. 7 d. 9 59. What command can you use to remove a directory that isn't empty? a. mv -r dir c. rmdir -r dir e. del -r dir b. deldir -r dir d. rm -r dir 60. If file foo contains ninety-nine lines, each of which is the two-digit line number of the line in the file (01 through 99), what is the output on your screen of this command: sort -r foo foo | tail -4 | head -1 a. 98 c. 04 04 e. 96 b. 96 96 d. 02 61. If you type the command grep pattern which of the following key sequences will send an EOF and take you immediately back to the command prompt? a. [CTRL-C] c. [CTRL-R] e. [CTRL-L] b. [CTRL-U] d. [CTRL-D] 62. If file twenty contains 20 lines, and file thirty contains 30 lines, then how many lines are output on your screen by this command: tail twenty | cat thirty a. 20 d. 40 b. no output on screen e. 30 c. 50 63. In an empty directory, how many arguments are passed to the rm command in this bash command line? touch a a1 a2 ba ca ; rm a* a. 1 c. 2 e. none b. 3 d. 4 64. What is the output on your screen of this sequence of three shell commands: echo x >abc ; ls >abc abc ; wc abc a. no output on screen d. 1 1 2 abc b. 1 1 3 abc e. 0 0 0 abc c. 1 1 4 abc 65. What appears on your screen after this sequence of commands: echo one >x ; cp x y ; echo two >>y ; sort x >y ; cat y a. empty file - no output on the screen b. one c. two d. one followed by two e. two followed by one 66. What is the output on your screen of this command sequence: echo foo >file ; echo bar | sort file a. bar d. bar followed by foo b. an error message e. foo c. foo followed by bar 67. What is the output on your screen of this shell command line in an empty directory? touch .1 .2 .3 4 5 6 ; echo .* a. an error message from echo saying .* does not exist b. . .. .1 .2 .3 c. .1 .2 .3 4 5 6 d. .* e. 4 5 6 68. What is the output on your screen of this sequence of three shell commands: echo hi >wc ; ls wc >wc ; wc wc a. no output on screen d. 1 1 3 wc b. 2 2 4 wc e. 0 0 0 wc c. 1 1 2 wc 69. What is the output on your screen of the following sequence of commands: echo wc >wc ; wc wc >wc ; cat wc a. 0 0 0 wc d. 1 1 3 wc b. 1 1 2 wc e. wc c. no output on screen 70. If my current directory is /bin, which of these pathnames is equivalent to the file name /bin/ls? a. ../bin/ls/. c. ./bin/ls e. ../../bin/ls b. /root/bin/ls d. ls/. 71. What text is output by this bash shell command sequence: echo cow >foo ; echo dog | head -1 foo a. dog followed by cow d. cow followed by dog b. foo e. cow c. dog 72. How do I change "foo" to "bar" on lines 25 to 30 in the vim editor? a. :25,30s/foo/bar/ d. :25,30 change "foo" "bar" b. :25c foo bar *5 e. :25s/foo/bar/*5 c. :25-30 change "foo","bar" 73. What appears on your screen after this bash shell command line? echo xx >z ; ls z > wc a. 2 d. no output on screen b. 3 e. 1 1 2 c. 1 1 3 74. If file /a contains 30 lines, and file /b contains 50 lines, then how many lines are in file /c after this sequence of shell commands: cat /a /b >/c ; sort /c >/c ; sort /c /a /b >/c a. no lines (empty file) d. 80 b. 30 e. 50 c. 160 75. Which command line below does not show any lines from inside the file dog? a. less dog c. tail -8 dog e. ls dog b. sort -r dog d. head -3 dog 76. How can you ask the bash (Linux) shell to complete commands or file names for you? a. Type [CONTROL]-[C] and the shell will present a menu of commands. b. You can type the first part of the command or file name and press the ALT key. c. Push key F1 and the system will present a menu of commands. d. Type [CONTROL]-[D] and the shell will present a menu of commands. e. You can type the first part of the command or file name and press the TAB key. 77. If file /a contains 40 lines, and file /b contains 60 lines, then how many lines are output on your screen by this command: sort /a /b | cat /a | cat /b a. 100 c. 160 e. 40 b. 200 d. 60 78. If directory cow contains only these four three-character file names: .AA, .A1, .BB, .B., then what is the output on your screen of this command line: echo cow/* a. cow/.B. b. cow/.AA cow/.A1 cow/.BB cow/.B. c. no output on screen d. cow/.AA cow/.A1 cow/.BB e. cow/* 79. In an empty directory, how many arguments are passed to the rm command in this bash command line? touch 2a a a1 ba ca .a ; rm a* a. 4 c. 2 e. 1 b. 3 d. none 80. If file /a/b contains 99 lines, each of which is the two-digit line number of the line in the file (01 through 99), what is the output on your screen of this command: sort /a/b /a/b | tail -4 | head -1 a. 04 04 c. 98 e. 96 96 b. 96 d. 01 01 81. What would you see if you typed this command: cat /foo a. The contents of your subdirectory named foo b. The contents of the file foo located in your home directory c. The contents of your directory named foo d. The contents of the file foo located in the root directory e. The contents of the file foo located in the parent directory 82. What is the output on your screen of this shell command line in an empty directory? touch 1 2 3 .a .ab .abc ; echo [.]* a. an error message from echo saying [.]* does not exist b. [.]* c. . .. .a .ab .abc d. no output on screen e. .a .ab .abc 83. If I am in my home directory named /home/idallen and empty is an empty sub- directory, what is true after this command line: touch ./pig ; mv ./empty/../pig ../idallen/cow a. the command fails because path ./empty/../pig does not exist b. the directory empty now contains only a file named cow c. the directory empty/.. now has a file named cow in it d. the command fails because path ../idallen/cow does not exist e. there is a second copy of the file pig in the file named cow 84. If file nine contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: sort nine nine | tail -4 | head -1 a. 8 c. 4 4 e. 6 6 b. 6 d. 1 1 85. What is the output on your screen of the following sequence of commands: echo hi >wc ; wc wc >hi ; cat hi a. 1 1 2 wc d. 1 1 3 wc b. no output on screen e. hi c. 0 0 0 wc 86. What is the output on your screen of this shell command line in an empty directory? touch .12 .345 .6789 ; echo .??* a. .12 .345 .6789 b. . .. .12 .345 .6789 c. an error message from echo saying .??* does not exist d. no output on screen e. .??* 87. What is the possible output on your screen of this command line: echo wc >date ; sort date >date ; cat date a. 1 6 29 date d. no output on screen b. wc e. 1 6 28 date c. Tue Feb 5 10:01:35 EST 2008 88. Which of these commands always returns you to your account home directory? a. cd /home c. cd .. e. cd /home/.. b. cd d. cd home 89. Which command line displays the contents of the Unix passwd file one page at a time? a. cat less | /etc/passwd d. less /etc/passwd b. cat /etc/passwd less e. /etc/passwd cat less c. /etc/passwd | less 90. Which of these statements is true? a. To interrupt a Unix process from the keyboard, type [CONTROL]-[D]. b. Command apropos is an exact synonym for command man. c. To erase an entire line of typing, type [ALT]-[DELETE]. d. To indicate End-of-File (no more input) to a program, type [CONTROL]-[D]. e. The file command creates a new, empty file in the current directory 91. Which of these statements is true? a. To indicate End-of-File (no more input), type [CONTROL]-[E]. b. You can only login to Unix once per userid; you cannot be logged in to the same machine twice. c. To erase an entire line of typing, type [CONTROL]-[E]. d. Unix commands can be entered in upper-case or lower-case letters; they are equivalent. e. Unix commands must be entered in lower-case letters. 92. If file foo contains nine lines, each of which is the one-digit line number of the line in the file, (1 through 9), what is the output on your screen of this command: cat foo foo | sort | tail -4 | head -1 a. 4 d. 8 b. 6 e. no output on screen c. 1 93. What command shows all the lines in file foo that contain the string bar? a. grep foo bar d. grep bar >foo b. cat foo > grep bar e. grep cat foo bar c. grep bar foo 94. If my current directory is /home, which of these pathnames is equivalent to the pathname /home/a/b/c? a. /a/b/c c. ../home/a/b/c e. ./home/a/b/c b. ../home/b/c d. ../a/b/c 95. If file /a contains 20 lines, and file /b contains 30 lines, then how many lines are in file /c after this sequence of shell commands: sort /a /b >/c ; cat /a >>/b ; sort /c /b /a >/c a. 80 d. 70 b. 50 e. 120 c. no lines (empty file) 96. In the output of the command ls -a, the one-character name . signifies what? a. The parent directory. b. A name that is hidden. c. A name with an unprintable character. d. The current directory. e. A current file. 97. If my current directory is /usr, which of these pathnames is equivalent to the pathname /usr/x/y/z? a. x/./y/z c. ./usr/x/y/z e. ../usr/y/z b. /x/y/z d. ../x/y/z 98. What command shows all the lines in file foo that contain the string group? a. grep group foo d. cat foo | wc group b. cat foo ; grep group e. grep group ; foo c. grep foo group 99. What is the output on your screen of this successful command line? cd /home/myhome ; mkdir foo ; mkdir bar ; pwd a. /home/myhome d. /bar b. /home/myhome/foo e. /home/myhome/bar c. /home/myhome/foo/bar 100. If /bin/bash is a file name, which pathname always leads to the same file? a. /bin/bash/. c. /../bin/./bash e. /bin/bin/../bash b. ./../bin/bash d. /bin/../bash 101. What is the output on your screen of this shell command line in an empty directory? touch .a .b .c ; echo [.]* a. an error message from echo saying [.]* does not exist b. . .. .a .b .c c. no output on screen d. [.]* e. .a .b .c 102. What is the output on your screen of this shell command line in an empty directory? echo ? a. . b. no output on screen c. ? d. an error message from echo saying ? does not exist e. .. 103. If /etc/passwd is a file name, which pathname always leads to the same file? a. ./etc/passwd d. /etc/passwd/. b. /etc/../etc/passwd e. ../etc/passwd c. /etc/./etc/../passwd 104. What is in file cow after running this bash shell command line? echo one two >cow three a. one two three d. echo one two b. one two cow three e. no output (empty file) c. one two 105. What is the output on your screen of this command sequence: echo dog >one ; echo cow | head -2 one a. dog followed by cow d. cow followed by dog b. dog e. cow c. an error message 106. If you type the command sort which of the following key sequences will send an EOF and take you immediately back to the command prompt? a. [CTRL-U] c. [CTRL-C] e. [CTRL-D] b. [CTRL-L] d. [CTRL-R] 107. Which of these command sequences will make file out contain all of the content of file in1 followed by all of the content of file in2? a. cat in1 in2 >out d. cp in1 >out in2 >out b. echo in1 in2 >out e. mv in1 in2 >out c. cp in1 in2 >out 108. If file twenty contains 20 lines, and file thirty contains 30 lines, then how many lines are output on your screen by this command: tail thirty | cat twenty a. 20 d. 21 b. no lines (no output) e. 50 c. 30 109. If directory /a/b contains these four three-character file names: .aa, .ab, .a?, .a*, then what is the output on your screen of the following bash shell command line: echo /a/b/??? a. /a/b/??? b. /a/b/.aa /a/b/.ab c. no output on screen d. /a/b/.aa /a/b/.ab /a/b/.a? /a/b/.a* e. /a/b/.a? 110. If /bin/bash is a file name, which pathname always leads to the same file? a. ./bin/bash c. /bin/../bin/bash e. /bin/../bash b. /bin/bin/../bash d. /bin/bash/. 111. Which command shows the name of the current computer: a. hostname c. ifconfig e. du b. w d. who 112. What appears on your screen after this bash shell command line? mkdir foo ; rmdir foo | wc -c a. no output on screen d. 0 b. 1 e. 4 c. 3 113. Which of the following shell command lines displays all the names in the current directory that are exactly three digits long (and no others)? a. echo [1-3][1-3][1-3] d. echo ??? b. echo [3][3][3] e. echo [0-9][0-9][0-9] c. echo [?][?][?] 114. If my current working directory is /home, and my home directory is /home/me, which of the of the following commands copies the Unix password file into my home directory under the name foo? a. cp ../etc/passwd ../me/foo b. cp ./me/../etc/passwd ../home/me/foo c. cp ../../etc/passwd /me/foo d. cp me/../../etc/passwd me/foo e. cp ../home/me/../etc/passwd ./me/./foo 115. What is true about this bash shell command line? date >ls ; ls -ls ls >wc a. The wc command counts the output of the ls command. b. The ls command receives the output of date on standard input. c. The file wc has one line in it. d. The shell finds and executes three different commands. e. The ls command is executed more than once. 116. What appears on your screen after this bash shell command line? echo hi >a ; echo a | wc -c a. 1 d. 4 b. no output on screen e. 3 c. 2 117. Which command line finds all possible utilities available for compiling programs? a. grep compile /etc/* d. man * | grep compile b. man compile e. man -k compile c. grep /etc/* compile 118. Given an existing file of yours named /a/b/x, what is the output on your screen of this sequence of three shell commands: echo hi >/a/b/x ; wc /a/b/x >/a/b/x ; cat /a/b/x a. 1 1 1 /a/b/x d. 1 1 3 /a/b/x b. 1 1 2 /a/b/x e. no output on screen c. 0 0 0 /a/b/x 119. What is in the file bar after this command sequence: echo hi >x ; echo ho >x ; mv x y >bar a. hi followed by ho b. hi c. no such file (nonexistent) d. ho e. nothing - empty file - no data 120. What text is output by this bash shell command sequence: echo dog >out ; echo cat | sort out a. dog followed by cat d. cat followed by dog b. dog e. cat c. out 121. What is the output on your screen of this successful command sequence? cd /tmp ; mkdir foo ; mkdir bar ; pwd a. /tmp/foo/bar c. /tmp/foo e. /bar b. /tmp/bar d. /tmp 122. If you type the command head which of the following key sequences will send an EOF and take you immediately back to the command prompt? a. [CTRL-C] c. [CTRL-R] e. [CTRL-D] b. [CTRL-U] d. [CTRL-L] 123. Which of these command sequences will make file foo contain all of the content of file a followed by all of the content of file b? a. cat a >foo ; cat b >>foo d. echo a b >foo b. mv a b >foo e. cp a >foo ; cp b >>foo c. cp a b >foo 124. What appears on your screen after this bash shell command line? echo hi >a ; cat a | wc -c a. 1 d. 4 b. 2 e. no output on screen c. 3 125. In an empty directory, how many words are in file cow after this bash shell command line? touch dog dog cat ; ls >cow a. 1 d. no output (empty file) b. 3 e. 4 c. 2 126. If file x contains 10 lines, and file y contains 20 lines, then how many lines are in file cat after this sequence of bash shell commands: sort x y >z ; tail -5 y >y ; sort x y z >cat a. no lines (empty file) d. 40 b. 50 e. 45 c. 60 127. If my current working directory is /home, and my home directory is /home/xx, which of the of the following commands copies the Unix password file into my home directory under the name foo? a. cp ../home/xx/../etc/passwd ./xx/./foo b. cp xx/../etc/passwd ../home/xx/foo c. cp ../../etc/passwd /xx/foo d. cp ../etc/passwd ../xx/foo e. cp xx/../../etc/passwd xx/foo 128. If file x contains 10 lines, and file y contains 20 lines, then how many lines are in file cat after this command line: sort x y >z ; tail -5 x >x ; sort x y z >cat a. no lines (empty file) d. 60 b. 50 e. 55 c. 40 129. If file nine contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: sort nine nine | tail -5 | head -1 a. 9 c. 1 1 e. 7 b. 1 d. 5 5 130. Which command line displays all the non-hidden names in the current directory that contain the letter x (and no other names)? a. echo *x* c. echo *x e. echo [*x*] b. echo ?x? d. echo x* 131. In an empty directory, how many arguments are passed to the rm command in this bash command line? date >a1 ; touch a2 ba ca >all ; rm a* a. none c. 4 e. 3 b. 1 d. 2 132. If you type the command echo 'missing quote which of the following key sequences will interrupt it and take you immediately back to the command prompt? a. [CTRL-C] c. [CTRL-U] e. [CTRL-D] b. [CTRL-R] d. [CTRL-L] 133. What is in the file out after this command sequence: echo hi >x ; echo ho >>x ; cp x y >out a. hi followed by ho b. no such file (nonexistent) c. nothing - empty file - no data d. hi e. ho 134. What appears on your screen after this bash shell command line? echo hi >a ; cp a b | wc -c a. 1 d. 3 b. 0 e. no output on screen c. 2 135. In the output of the command ls -a, a dot that begins a name signifies what? a. The current directory. b. A name that is hidden. c. A name with an unprintable character. d. A current file. e. The parent directory. 136. In an empty directory, how many arguments are passed to the wc command in this command line? date >o1 ; touch a1 b2 out >o1 ; wc o* a. 2 c. 3 e. 5 b. 1 d. 4 137. How many lines are in the file out after this command sequence: echo hi >x ; echo ho >>x ; cat x x x >out a. nothing - empty file - no data b. 6 c. 1 d. 3 e. 2 138. What is the output on your screen of this shell command line in an empty directory? echo * a. an error message from echo saying * does not exist b. * c. . .. d. . e. no output on screen 139. What command shows all the lines in file /etc/group that contain the string idallen? a. grep idallen /etc/group d. grep idallen ; /etc/group b. cat /etc/group ; grep idallen e. cat /etc/group | wc idallen c. grep /etc/group idallen 140. Given an existing file of yours named /a/x, what is the output on your screen of this sequence of three shell commands: echo hi >/a/x ; sort /a/x >/a/x ; wc /a/x a. 0 0 0 /a/x d. no output on screen b. 2 2 4 /a/x e. 1 1 3 /a/x c. 1 1 2 /a/x 141. If you type the command cat which of the following key sequences will send an EOF and take you immediately back to the command prompt? a. [CTRL-D] c. [CTRL-C] e. [CTRL-U] b. [CTRL-L] d. [CTRL-R] 142. What appears on your screen after this bash shell command line? echo hi >a ; ls a | wc -c a. no output on screen d. 1 b. 3 e. 2 c. 4 143. What is the output on your screen of this shell command line in an empty directory? touch a .a bc .bc def ; echo [ab]* a. [ab]* b. a .a bc .bc c. no output on screen d. an error message from echo saying [ab]* does not exist e. a bc 144. What is the output on your screen of this shell command line in an empty directory? touch .a .b .c ; echo .* a. an error message from echo saying .* does not exist b. .* c. no output on screen d. . .. .a .b .c e. .a .b .c 145. If you type the command sleep 60 which of the following key sequences will interrupt it and take you immediately back to the command prompt? a. [CTRL-R] c. [CTRL-C] e. [CTRL-U] b. [CTRL-D] d. [CTRL-L] 146. If I am in my home directory named /home/me and x is an empty sub- directory, what is true after this command line: touch ./x/fil ; mv x/./fil x/../../me/./y a. there is a second copy of the file fil in the file named y b. the directory x is still empty c. the command fails because the path x/./fil does not exist d. the command fails because the path x/../../me does not exist e. the directory x now contains only a file named y 147. In an empty directory, what appears on your screen after this bash command line? touch a ; ls >wc -l a. no output on screen d. 2 b. 0 e. 1 c. 3 148. What is the output on your screen of this shell command line in an empty directory? touch x .a .ab .cde .fghi ; echo .??* a. .??* b. an error message from echo saying .??* does not exist c. .cde .fghi d. .ab .cde .fghi e. . .. .a .ab .cde .fghi 149. If my current working directory is /home, and my home directory is /home/me, which of the following commands copies the Unix password file into my home directory under the name foo? a. cp ./me/../etc/passwd ../home/me/foo b. cp ../home/me/../etc/passwd ./me/./foo c. cp ../etc/passwd ./me/foo d. cp ../etc/passwd ../me/foo e. cp ../../etc/passwd /me/foo 150. If file foo contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: cat foo foo | cat | tail -4 | head -1 a. 9 c. 6 e. 7 b. 8 d. 5 151. Which Unix command sequence deletes a directory and everything inside it? a. rmdir -r dir c. rm -all dir e. rm -r dir b. deltree -all dir d. rmdir -all dir 152. In an empty directory, how many arguments are passed to the cat command in this bash command line? touch a1 a2 ac ba .a ; cat a* a. none c. 3 e. 2 b. 1 d. 4 153. What appears on your screen after this bash shell command line? echo hi >out ; wc -c out a. 3 out d. 5 out b. 2 out e. 4 out c. no output on screen 154. If file a contains 20 lines, and file b contains 30 lines, then how many lines are in file out after this sequence of bash shell commands: cat a b >c ; head c >c ; sort a b c >out a. 30 d. no lines (empty file) b. 100 e. 60 c. 50 155. In an empty directory, how many arguments are passed to the cat command in this bash command line? touch a1 a2 ba ca ; cat a* a. 3 c. 2 e. none b. 1 d. 4 156. If my current directory is /etc, which of these pathnames is equivalent to the file name /etc/passwd? a. ./passwd c. ./etc/passwd e. ../passwd b. ../etc/passwd/. d. /passwd 157. What command shows all the lines in file /etc/group that contain the string idallen? a. cat /etc/group > grep idallen d. grep idallen >/etc/group b. cat /etc/group | wc idallen e. grep /etc/group idallen c. grep idallen /etc/group 158. How many lines are in the file bar after this command sequence: echo hi >x ; echo ho >>x ; cat x x >bar a. 2 b. 6 c. 4 d. nothing - empty file - no data e. 1 159. Which of the command lines below can generate a non-empty file? a. tail /a/b >/a/b d. wc -l /a/b >/a/b b. cat /a/b /a/b /a/b >/a/b e. sort /a/b >/a/b c. head -5 /a/b >/a/b 160. If file nine contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: cat nine nine | sort -r | head -4 | tail -1 a. 9 c. 7 e. 5 b. 6 d. 8 161. In an empty directory, what appears on your screen after this bash command line? touch a ; ls | wc -l a. no output on screen d. 3 b. 0 e. 2 c. 1 162. What can you do to get back (redo) the last command you typed to the bash shell? a. Type the k key. d. Type [ALT]-[F2] b. Use the "PageUp" key. e. Type [CONTROL]-[ALT]-[UP] c. Use the "UpArrow" key. 163. What appears on your screen after this bash shell command line? echo hi | wc -c a. 3 d. 0 b. no output on screen e. 1 c. 2 164. What is the output on your screen of this successful command sequence? cd /home/foo ; touch dir ; mkdir bar ; pwd a. /home/foo d. /home/foo/dir b. /home/foo/bar e. /home/foo/dir/bar c. /bar 165. Which command sequence below outputs only lines 10-15 of the Unix password file? a. head -15 /etc/passwd | tail -5 /etc/passwd b. head -15 /etc/passwd | tail -6 c. tail -10 /etc/passwd | head -15 /etc/passwd d. tail -15 /etc/passwd | head -10 e. head -10 /etc/passwd | tail -15 /etc/passwd 166. If file /a contains 30 lines, and file /b contains 50 lines, then how many lines are output on your screen by this command: cat /a | sort /b a. no lines (empty file) d. 50 b. 20 e. 30 c. 80 167. What is in the file named file after this command sequence: echo a >c ; echo b >>c ; mv c d >file a. nothing - file is empty - no data b. a c. a followed by b d. no such file (nonexistent file) e. b 168. If directory /dir contains these three four-character file names: .123, .124, .???, then what is the output on your screen of the following command line: echo /dir/???? a. /dir/.123 /dir/.124 /dir/.??? b. no output on screen c. echo: /dir/????: No such file or directory d. /dir/.123 /dir/.124 e. /dir/???? 169. How many lines are in file out after this command line? echo hi >dog >out >cat a. no such file (file does not exist) b. nothing - empty file - no data c. 2 d. 3 e. 1 170. If file nine contains nine lines, each of which is the one-digit line number of the line in the file (1 through 9), what is the output on your screen of this command: cat nine nine | tail -5 | head -1 a. 6 c. 8 e. 7 b. 5 d. 9 171. Which command pipeline outputs the count of the number of userids containing the string allen that are currently logged in? a. grep allen | who | wc d. who | wc allen | grep b. who | grep allen | wc e. who | grep | allen wc c. grep allen | wc | who 172. What is the output on your screen of this shell command line in an empty directory? cat * a. . b. no output on screen c. an error message from cat saying * does not exist d. * e. . .. 173. If foo is a sub-directory that contains only the file single, what happens after this command: mv ./foo/single foo/../double a. the directory foo now contains only a file named double b. the command fails because the name foo/../double does not exist c. there is a second copy of the file single in the file named double d. the directory foo is now empty e. the command fails because the name double does not exist 174. What appears on your screen after this bash shell command line? echo hi | wc a. 1 1 2 d. 1 2 1 b. no output on screen e. 2 1 1 c. 1 1 3 175. What is the output on your screen of this shell command line in an empty directory? touch 1 .1 23 .23 456 ; echo [12]* a. 1 .1 23 .23 456 b. [12]* c. 1 23 d. an error message from echo saying [12]* does not exist e. 1 .1 23 .23 176. In an empty directory, how many words are in file out after this bash shell command line? touch 1 2 3 2 1 ; ls >out a. 6 d. 4 b. 3 e. 5 c. no output (empty file)