CST334 TEST 2 (100 points) NAME: READINGS vi Editor: Chapter 2,8 emacs Editor: Appendix C Streams & Redirection: Sections 5.2, 5.3 Pipes and Tees: Sections 5.4, 5.5 Filenames & Wildcards: Section 3.1 Job Control: Section 5.10 Filter Commands: details in Chapter 6 SKILLS use vi to edit/add to a file use emacs to edit/add to a file navigate around and examine directories and use detailed listings copy/move files and directories using relative and/or absolute pathnames as needed remove files and directories deal with problems of access permission that may arise while working in unix Search a file or a collection of files using grep and wildcards use input and output redirection to/from unix commands Form compound commands using pipes develop complex filter commands to accomplish special tasks run and manage jobs in the background PRACTICE ACTIVITIES FOR TEST 2 Do all of the following on mlc104 (your grade will partially depend on having the correct files in the right location) and fill in the blanks with the correct answer or command. Make sure your home directory has permission 705 so I can examine it. Each question is worth 5points. Questions with (*) should be performed on mlc104. If you can't accomplish a critical task, write down a partial answer, call me over and I will complete it for you, marking your paper accordingly. 1* Make a directory called quiz2 in your home directory ________________ 2* There is also a quiz2 directory in the shared cst334 directory. With one command Copy all the files in it into your own quiz2 directory ____________________________ 3* In the group of files you copied over, there are a number of files that begin with the word file… Of these, three are much smaller in size than the others. What are the names of these three files: ___________________________ 4* Find the three and combine (cat) them into one file named short.txt_______________________ 5*. Use a wildcard with ls to list only file22.txt file23.txt file2.txt and file2x.txt AND NOTHING ELSE: ____________________________________ 6*. Use a wildcard with ls to list only file2x.txt file5x.txt and filex.txt AND NOTHING ELSE: ____________________________________ 7* The file cipher.txt contains a secret message consisting of five words. Each word in the message follows the pattern of letters unix . Write a single command that uses grep to find all occurrences of this pattern in the file and redirect the output into the file message in your quiz2 directory. ___________________________________ 8* What is the message? _________________________________________ 9* Use emacs to edit file mars.txt and replace all occurrences of mars with jupiter. Move the first paragraph to the bottom. Save it to a new filename jupiter.txt. Do the same thing in vi—replace mars with venus, etc. 10* make an alphabetical list of all the users currently running vim on the system_____________ 11. Given the following output from ps au, what is the process ID of the ssh process for user trebold? dynn1266 dynn1266 dynn1266 dynn1266 dynn1266 dynn1266 trebold trebold trebold dynn1266 dynn1266 dynn1266 dynn1266 trebold 12. a) b) c) d) e) f) g) 32003 32006 32007 32012 978 1404 1419 1833 1834 1867 1870 1871 1877 1894 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 4888 5404 5404 5104 10056 9940 5588 4144 5584 4892 5404 5404 5104 5588 820 960 416 736 2852 2776 1476 1840 1472 856 956 416 732 948 pts/7 pts/7 pts/7 pts/7 pts/7 pts/7 pts/1 pts/1 pts/2 pts/7 pts/7 pts/7 pts/7 pts/2 T T T T T T Ss S+ Ss S+ S+ S+ S+ R+ 11:19 11:19 11:19 11:19 11:35 11:41 11:43 11:44 11:44 11:45 11:45 11:45 11:45 11:45 Run vi on file cipher.txt then Suspend the job ___________ Run emacs on file3.txt then Suspend the job ___________ Run vi on file5.txt then Suspend the job ___________ look at all your jobs __________ bring the emacs job into the foreground ___________ exit emacs normally ____________ kill the other 2 suspended jobs (one at a time) _____________ 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 man ps sh -c (cd /usr/ sh -c (cd /usr/ /usr/bin/less vim cipher.txt vim file5.txt -bash ssh tom@terra.m -bash man kill sh -c (cd /usr/ sh -c (cd /usr/ /usr/bin/less ps –au