50 M/C Questions -1- 1 Minute Per Question 50 M/C Questions -2- 1 Minute Per Question 5. [44/110] Which of the following invocations of command.sh is dependent on a PRINT Name: LAB Section: correct current directory to work properly? Test Version: ___ One-Answer Multiple Choice 50 Questions − 15 of 15% a. /root/bin/command.sh b. /bin/command.sh c. usr/bin/command.sh d. /usr/bin/command.sh ☞ Read all the words of these instructions and both sides (back and front) of all pages. e. command.sh ☞ Use your full, unabbreviated name on the mark-sense form. Do not abbreviate your name. 6. [48/110] In the /etc/sudoers file, what word goes in front of ALL=(ALL) ☞ Put the three-digit Test Version above into NO. OF QUESTIONS and NO. OF STUDENTS ALL to allow the user wjiang to run commands as root? ☞ Fill in the bubbles with pencil only, no pen. Enter your NAME, Test Version, and answers. ☞ Manage your time. Answer questions you know, first. One Answer per question. a. #wjiang b. sudoers c. wjiang d. wheel e. %wjiang 7. [50/110] Which arguments to mount -o bind would create a file system loop 1. [23/110] Which line below puts only the count of the number of lines in the that would cause problems for recursive commands such as find,du or rm-rf password file into the variable count? a. /home/user/private /public a. count=$( wc -l /etc/passwd ) b. /home /home/wjiang/dir b. count=$( awk -F: /etc/passwd | wc -l ) c. /home /var/home c. count=$( wc /etc/passwd | awk echo $1 ) d. /var/home /home d. count=$( cat -c /etc/passwd ) e. /var1 /var e. count=$( wc -l /etc/passwd | awk '{print $1}' ) 8. [50/110] Which of the following commands could be used to disable password 2. [29/110] What is the output (if any) of this bash shell program fragment? (There authentication for the user, wjiang? are blanks between all the letters in the word list section of the for loop.) a. passwd -x wjiang b. gpasswd wjiang s=0 c. passwd -l wjiang d. passwd_disable wjiang for i in 1 2 3 4 5 6 7 8 9 e. passwd -d wjiang do 9. [51/110] If archive.tar.gz is a compressed tar archive, which command s=$((s+i)) could you run to produce a listing of its contents without extracting it? done echo "$s" a. tar -tgz archive.tar.gz b. tar -tgz archive a. 123456789 b. 987654321 c. tar -tzf archive d. tar -xzf archive.tar.gz c. 1 2 3 4 5 6 7 8 9 d. 1 e. tar -tzf archive.tar.gz e. 45 10. [60/109] If a shell script myscript.sh is called this way: ./shifttest.sh a b c d 3. [31/110] To set up SSH key login in Linux, what is the command to copy the public and the first line inside the script below the script header is key to the server? shift 2; echo "$#$1" a. ssh-copy-id b. ssh-keygen c. ssh-add what is the output of that line? d. ssh-agent e. ssh a. 2c b. 2a c. 2b d. 3b e. 4c 4. [35/110] What is the correct syntax to mount an MS DOS formatted floppy disk (do 11. [61/110] Which line below is most likely to be the beginning of an error message? not assume that there is an entry in /etc/fstab)? a. echo 2<$1 "... " b. echo 1>&2 "... " a. mount -t vfat /dev/fd0 /mnt/floppy c. echo 2>&1 "... " d. echo 2>$1 "... " b. mount -t msdos /dev/floppy /mnt/floppy e. echo 1<&2 "... " c. mount -t iso9660 /dev/fd0 /mnt/floppy d. mount /dev/floppy /mnt/fd0 12. [61/110] Which of the following commands would you use configure the httpd e. mount -t vfat /mnt/floppy /dev/fd0 daemon to run in runlevels 2,3,4, and 5? a. httpd --levels 2345 on b. httpd run 2345 c. chkconfig httpd on d. runlevel httpd on e. service httpd on CST 8177 − Winter 2015 − Midterm Test #2 − 15% Wenjuan Jiang & Ian! D. Allen CST 8177 − Winter 2015 − Midterm Test #2 − 15% Wenjuan Jiang & Ian! D. Allen 50 M/C Questions -3- 1 Minute Per Question 50 M/C Questions -4- 1 Minute Per Question 13. [64/110] What is the correct output of the following command? printf "hello 20. [72/110] Of the following directories, which would you expect to contain the most %s, your number is %d" wenjuan 33 system administration commands that require root privileges? a. hello %s, your number is %d wenjuan 33 a. /sbin b. /usr/local/bin b. hello wenjuan, your number is 33 c. /sys/admin/bin d. /usr/bin c. hello %wenjuan, your number is %33 e. /bin d. hello, your number is 21. [73/110] If you have a file crontab.day of commands in crontab format, e. Issue a syntax error information you could submit that file to be your live crontab file by running which of the 14. [65/110] What is the correct syntax to redirect both standard output and standard following commands? error into the same output file? a. crontab < crontab.day a. ls -l >bar 2>&1 b. ls -l >bar 2>bar b. echo crontab.day | crond c. ls -l >bar 2>$1 d. ls -l 2>$1 >bar c. crontab -l crontab.day e. ls -l 2>&1 >bar d. crontab -e crontab.day 15. [65/110] Which of the following commands would you use to resize an ext4 file e. crontab > crontab.day system to consume the remaining free space on its volume? 22. [74/110] To resume a stopped process in the background using Job Control, where a. fsck b. mkfs c. fsck.ext4 N is the job number of the process and PID is its process ID, you would type d. resize2fs e. mkfs.ext4 a. bg %PID b. fg N c. fg %PID 16. [67/109] Which of the following could you use as options for the tar command to d. bg %N e. fg PID extract a gzip-compressed archive? 23. [74/109] What would the following command do: at 7pm a. -czf b. -egvf c. -xzvf d. -ezvf e. -tgz a. read commands from stdin to be run once at 7pm 17. [68/110] What command line modifies and moves (in one command line) the home b. run the user’s crontab jobs every day at 7pm directory foo to bar for the existing user wjiang? c. read commands from stdin to be run every day at 7pm a. usermod -d -m /home/bar wjiang d. run the user’s crontab jobs at 7pm b. usermod -dm /home/bar wjiang e. issue an error message c. usermod -m -d /home/foo /home/bar 24. [80/110] What command would you use to list your at job numbers? d. usermod -d -m /home/wjiang bar a. atq b. at -c c. at -v d. at -q e. at -m e. usermod -m -d /home/bar wjiang 25. [82/110] If bar is a directory that contains only the file foo and /dir1 is an 18. [68/110] Which of the following is a proper way to change the /etc/sudoers empty directory, what is in /dir1 after running the following command? file? rsync -avH bar/. /dir1 a. echo > /etc/sudoers b. nano /etc/sudoers a. nothing b. bar c. dir1 c. vi /etc/sudoers d. vim /etc/sudoers d. foo e. a symlink to foo e. visudo 26. [82/110] Which command line adjusts the CPU priority of the tar command? 19. [71/110] If string=centOS then which one of the following case patterns a. tar -n b. tar -10 c. fg will match this statement: case "$string" in d. bg e. nice tar a. ???tOS ) echo yes ;; 27. [82/110] Which of the following commands would be used to add the user b. @ ) echo yes ;; wjiang to the group wheel? c. ?centO? ) echo yes ;; a. groupadd -a wheel wjiang d. (*OS echo yes ;; b. useradd wjiang wheel e. [cent] | [CENT] ) echo yes ;; c. groupmod -a wjiang wheel d. gpasswd -a wjiang wheel e. usrgrp wjiang wheel CST 8177 − Winter 2015 − Midterm Test #2 − 15% Wenjuan Jiang & Ian! D. Allen CST 8177 − Winter 2015 − Midterm Test #2 − 15% Wenjuan Jiang & Ian! D. Allen 50 M/C Questions -5- 1 Minute Per Question 50 M/C Questions -6- 1 Minute Per Question 28. [83/110] Which of the following commands on a Unix/Linux system displays the 37. [88/110] A crontab entry of 5 10 * * * /bin/somecommand processes running on the system showing the relations of the processes? would run somecommand when and how often? a. listtop b. pstree c. psls a. at 12:05am every business day and Saturday d. pstop e. toplist b. at 5:10am every business day 29. [84/110] Assuming you are not currently root and are a sudoer, which of the c. at 10:05am every business day following commands could you use to simulate a full login as wjiang without d. at 5:10am every day knowning their password? e. at 10:05am every day a. su sudo wjiang b. sudo wjiang 38. [88/110] Fill in the blanks. The chroot program takes a(n) _____ which will be c. sudo - wjiang d. sudo su - wjiang the ____ for a shell or a command. e. su - wjiang a. argument, ROOT directory b. directory, argument 30. [84/110] To see a list of disk partitions that the kernel has detected, you could look c. input, option d. command, argument at the contents of which file? e. option, input a. /etc/partitions b. /dev/partitions 39. [88/110] To send SIGTERM to a process with process ID 30727, which of the c. /proc/partitions d. /lib/partitions following commands would you use? e. /dev/sda a. signal -SIGTERM 30727 b. kill -SIGTERM 30727 31. [84/110] What would be the output of the following command line: c. send 30727 SIGTERM d. send -SIGTERM 30727 echo a b c | awk '{print $NF}' e. kill 30727 SIGTERM a. 3 b. NF c. a b c 40. [89/110] If you want a directory www to be added automatically to the HOME d. no output e. c directory of every newly created account, where would you put the www directory so 32. [84/110] Which of the following commands could be used to bring a system into that useradd would make this happen? single user mode? a. /etc/profile b. /etc/sysconfig/default a. telinit 0 b. init 0 c. /etc/default d. /etc/login.defs c. shutdown -h now d. telinit 6 e. /etc/skel e. shutdown now 41. [89/109] Which fdisk internal command letter displays the list of all partitions? 33. [84/110] Which of the following commands could be used to force the user a. p b. L c. l d. f e. q wjiang to change their password the next time they log in? 42. [90/110] Which of the following signals cannot be handled or ignored? a. passwd -d 0 wjiang b. force -d 0 wjiang a. SIGINT b. SIGSUSP c. SIGHUP c. passwd wjiang d. chage -d 0 wjiang d. SIGTERM e. SIGKILL e. gpasswd wjiang 43. [97/110] The cron system can run commands at most every 34. [85/110] What command will show the amount of free disk space in a partition? a. hour b. second c. minute a. ls b. df c. fdisk d. mount e. find d. day e. millisecond 35. [86/110] In an argument to rsync or scp a colon would come immediately after 44. [98/110] Which of the following commands could be used to create a group named a wheel? a. absolute pathname b. remote file c. local file a. groupadd wheel b. gpasswd -c wheel d. local host e. remote host c. gshadow -a wheel d. newgrp wheel 36. [86/110] Which of the following options for bash or sh might useful for e. gpasswd -a wheel debugging a shell script? 45. [100/110] A -H option to rsync would cause it to a. -r b. -l c. -c d. -z e. -x a. not overwrite newer files b. work verbosely c. overwrite newer files d. preserve timestamps e. preserve hard links CST 8177 − Winter 2015 − Midterm Test #2 − 15% Wenjuan Jiang & Ian! D. Allen CST 8177 − Winter 2015 − Midterm Test #2 − 15% Wenjuan Jiang & Ian! D. Allen 50 M/C Questions -7- 1 Minute Per Question 50 M/C Questions -8- 1 Minute Per Question 46. [100/110] Fill in the blanks. If you try to ______ a filesystem, and the command This page intentionally left blank. fails, you might use the _____ command to look for the cause. a. umount, mkdir b. mkfs, rmdir c. fsck, rm d. mount, fsck e. mount, mkfs 47. [101/110] Which of the following commands would you use to start the httpd daemon, if you had just installed it and if it were not already running? a. chkconfig httpd on b. kill -SIGSTART httpd c. go httpd d. httpd service on e. service httpd start 48. [105/110] Which of the following commands would you use to install the mailx software package (and its dependencies) on your CentOS virtual machine? a. pkginst mailx b. install pkg mailx c. pkg -i mailx d. yum -i mailx e. yum install mailx 49. [106/110] Which of the following commands could be used to create a new user named wjiang, with full name "Wenjuan Jiang" ? a. passwd -c "Wenjuan Jiang" wjiang b. newuser -c "Wenjuan Jiang" wjiang c. usermod -c "Wenjuan Jiang" wjiang d. newuser wjiang -c "Wenjuan Jiang" e. useradd -c "Wenjuan Jiang" wjiang 50. [108/110] Fill in the blanks. To perform critical filesystem operations, you should use at least the safety of ______ mode, but even safer would be ______ . a. rescue, power-off b. single-user, multi-user c. "Live CD", multi-user d. single-user, "Live CD" e. runlevel, "Live CD" CST 8177 − Winter 2015 − Midterm Test #2 − 15% Wenjuan Jiang & Ian! D. Allen CST 8177 − Winter 2015 − Midterm Test #2 − 15% Wenjuan Jiang & Ian! D. Allen