% CST8207 Week 10 Notes -- Shell Scripts, Midterm Test #2 % Ian! D. Allen -- -- [www.idallen.com] % Fall 2016 - September to December 2016 - Updated 2017-01-20 00:48 EST - [Course Home Page] - [Course Outline] - [All Weeks] - [Plain Text] Readings, Assignments, Labs, Tests, and ToDo ============================================ Read (at least) these things (All The Words) -------------------------------------------- 1. [Week 10 Notes HTML] -- this file -- **Read All The Words** 2. [Shell command substituion -- interpolate stdout into a command line using $(...) or \`...\`] 3. [Command exit status -- variable $?] 4. [Shell Control Structures -- if, then, else, test, `[...]`][1] 5. [List of Commands You Should Know] 6. [Linux and Sysadmin News in the World] 7. [Video Tutorials on Lynda.com] -- tagged by week number Assignments, Quizzes, and Lab work this week -------------------------------------------- > **Reminder:** There are now two quizzes that you need to complete on > Blackboard as part of your term Quiz mark. A third quiz will be posted > before the Final Exam. The Quizzes are *not* optional; see the [Course > Outline]. Check the due date for each assignment and put a reminder in your agenda, calendar, and digital assistant. Just like in the Real World, not all due dates are on the same days or at the same times. - Review last week. Did you do everything assigned last week? - Read [The VI (VIM) Text Editor] and optionally do the bonus [Assignment #04 HTML]. - Bonus (optional) [Assignment #06 HTML] about Midterm #1 - There is a checking program available to check your file format for this bonus assignment, but only people who Read All These Words will know about it. Wrong format means no marks. Do not save or submit the output of this checking program! - [Assignment #08 HTML] -- setting permissions, mode, `umask` - Do the worksheet first on Linux file system permissions (modes): - [Worksheet #08 ODT] -- use Open Office or Libre Office to complete this worksheet - [Worksheet #08 PDF] -- pretty version - [Worksheet #08 HTML] -- quick web online version (not pretty) - Bonus (optional) [Assignment #09 HTML] about Midterm #2 - There is a checking program available to check your file format for this bonus assignment, but only people who Read All These Words will know about it. Wrong format means no marks. Do not save or submit the output of this checking program! - [Assignment #10 HTML] -- tar, processes, syslog, crontab, at, mail, shell script - Really do **Read All The Words**. You don't get a second chance to get it right. ### Worksheets Worksheets are preparation for your assignments. You can't do the assignments without having done the worksheets first, and you can't do the worksheets without having first read the Course Notes: 1. Read. 2. Worksheet. 3. Assignment. Form a small study group to do the worksheets. Each person tries the example given, and you make sure you all get the same answers. Worksheets are not for hand-in; they are not worth marks; the assignments test your knowledge of the lectures and worksheets. > The worksheets are available in four formats: Open Office (ODT), PDF, HTML, > and Text. Only the Open Office format allows you "fill in the blanks" in > the worksheet. The PDF format looks good but doesn't allow you to type into > the blanks in the worksheet. The HTML format is crude but useful for quick > for viewing online. Do **NOT** open the Worksheet ODT files using any Microsoft products; they will mangle the format and mis-number the questions. Use the free Libre Office or Open Office programs to open these ODT documents. On campus, you can [download Libre Office here]. - [Worksheet #06 HTML] -- *Optional* Bonus VIM Text Editor Practice - This is an *optional* worksheet for a BONUS assignment using `vim` - Optional command-line VIM tutorial: the `vimtutor` program on the CLS. - Bonus (optional) [Assignment #04 HTML] -- the VIM text editor - Read [The VI (VIM) Text Editor] - [Worksheet #08 ODT] -- Linux file system permissions (modes) - This Worksheet is a prerequisite for [Assignment #08 HTML] - [Worksheet #08 PDF] -- PDF version - [Worksheet #08 HTML] -- HTML version - `chmod, ls -lid, umask` Worksheets prepare you for the upcoming assignments. Upcoming tests - Second Midterm Test Wed Nov 9 ---------------------------------------------- > The [NEW Test Instructions] have changed for this second Midterm test! > Re-read the instructions before you write the midterm test. Read the [NEW Test Instructions] (all the words) before your midterm tests. Put these dates into your phone! Use the **Name Game** link to test your name before the test. I don't answer questions about the instructions during the test. 1. **Second Midterm test:** 45 minutes; in lecture class on Wednesday in Week 10 (Nov 9) See the practice questions in [Practice Tests and Answers]. 2. **Final Exam:** 180 questions in 180 minutes in Week 15 - Thursday December 15 11h30 (11:30am to 2:30pm) in T117/119 - Three Hours! Take a bathroom break before you start the exam. - Assigned Seating in T117/119 (see your email for your assigned seat) Midterm tests take place in class in your 50-minute lecture period, not in your lab period. Each midterm test is 45 minutes long and contains approximately 45 multiple-choice questions similar to those found in [Practice Tests and Answers]. Do the practice test before the real test! The Final Exam is in T117/119 Thursday December 15 11h30 in Week 15. The Final Exam is three hours long. Take a washroom break before you start. ### Midterm Test #2 -- Wednesday November 9 - Midterm #2 takes place on Wednesday, November 9 (Week 10) in your scheduled lecture hour (not in your lab period). - For full marks, you must read the [NEW Test Instructions] before the test for important directions on how to enter your name, answers, your lab (not lecture) section number, and the test version number on the question sheet and the mark-sense forms. - There may be more questions on the test than you can answer in the time allowed; answer the ones you know, first. - A set of practice questions and answers for the second midterm test is posted: [Practice Tests and Answers]. - Blackboard has some quizzes taken randomly from the practice test. The full practice test itself is *not* part of your course grade, but the quizzes *are* part of your course grade. See below. See the [Week 04 Notes HTML] for how to earn all your quiz marks. - See the [Course Outline] for the mark weight of all the quizzes. **Material covered in Midterm 2:** Everything up to and including Symbolic Links and Assignment 7. See the [Practice Tests and Answers] for samples of possible questions. Midterm Test #2 Analysis ======================== - 168 students are registered in the course. - Of the 168, 15 did not write the test, leaving 153 who did. - Of the 153, 17 did not enter their own name correctly. - Of the 153, 18 did not enter their own student number correctly. - Of the 153, 7 did not enter a valid test version number. - Number of students who got question `#45` wrong even though the answer was given in the **Test Instructions** printed at the top of the test: `48` - The 153 class scores: 97.7 94.5 93.2 92.2 92.2 90.9 90.9 90.9 87.8 86.4 86.4 85.5 85.5 84.1 84.1 84.1 83.2 81.8 81.8 81.8 81.8 81 81 79.5 78.8 77.3 77.3 76.5 75 75 75 75 74.2 74.2 74.2 74.2 72.7 72.7 72.7 72.7 72 72 72 72 72 70.5 69.8 69.8 69.8 69.8 68.2 67.5 67.5 67.5 65.9 65.9 65.9 65.9 65.9 65.9 65.9 65.2 65.2 61.4 61.4 61.4 61.4 59.1 59.1 59.1 58.5 58.5 56.8 56.8 56.8 56.2 56.2 54.5 54.5 54.5 54.5 53.5 51.8 51.8 51.8 51.8 50 50 50 49.5 47.7 47.7 47.2 43.2 42.8 42.8 42.3 42.3 40.9 40.9 40.5 40.5 40.5 40.1 38.6 38.6 38.2 38.2 38.2 38.2 36.4 36.4 36.4 36.4 36 36 35.6 34.1 34.1 33.8 33.8 33.1 31.8 31.4 29.5 29.2 29.2 27.3 27.3 27.3 27 26.7 25.1 25 25 25 25 24.8 24.5 22.7 22.7 22.3 20.5 20.2 20 18.2 18.2 18 17.8 15.9 15.8 13.5 6.7 153: Pass 90 (58.8%) Fail 63 (41.2%) 24 A (15.7%) 11 A- 5 A 8 A+ 26 B (17.0%) 10 B- 12 B 4 B+ 17 C (11.1%) 4 C- 9 C 4 C+ 23 D (15.0%) 8 D- 7 D 8 D+ 63 F (41.2%) 57 F- 3 F 3 F+ 90% - 100% 8 ******** 80% - 90% 16 **************** 70% - 80% 26 ************************** 60% - 70% 17 ***************** 50% - 60% 23 *********************** 40% - 50% 14 ************** 30% - 40% 21 ********************* 20% - 30% 20 ******************** 10% - 20% 7 ******* 0% - 10% 1 * - You can see the class errors in [Midterm Test #2 PDF]. > I spent an hour or two correcting your errors on the mark-sense forms. > Before your next test, you need to re-read the [NEW Test Instructions]. > Penalties go up for making Scantron errors on the next test. Notes from the Classroom ======================== - **Take notes in class!** Keep a pad open on your desk. - Note that your Midterm Test #2 on Wednesday November 9 is worth more than five assignments put together. Don't spend all your time doing a little assignment at the expense of studying the [Practice Tests and Answers] for the Midterm Test. - I am holding three Review Classes to answer your questions about the first Midterm Test: - Review #1: Friday November 4 13:00 -- 14:00 in J208 - Questions done: 42 45 46 47 48 53 54 59 77 102 107 141 183 198 214 - Review #2: Tuesday November 8 14:00 -- 16:00 in T117 - Questions done: 5 23 25 27 29 39 40 52 58 60 61 67 68 69 70 72 73 75 78 79 83 85 91 102 105 107 108 124 124 126 154 179 184 186 190 192 201 211 213 214 227 230 - Review #3: Tuesday November 8 16:00 -- 17:00 in T304 - Questions done: 22 26 29 34 36 44 45 47 50 60 62 68 72 81 89 108 135 166 You must bring your questions from [Practice Tests and Answers] or from any of the many previous term midterm tests. I will show you how to best answer any of those questions. Commands Used ------------- - Keep a notebook with a [List of Commands][List of Commands You Should Know] in it. - You need to write down yourself what each command *does*. - I will check for this list in your lab periods. - Check the updated list of commands each week. - Bring your notes to class! Stop wasting time looking up commands. - Are you making notes from the worksheets on how each command works? - What do the options used in the worksheets mean, for each command? - Don't copy and use options that you don't understand! Marking Scheme for Bonus Assignment #09 ======================================= Bonus (optional) [Assignment #09 HTML] may be done after you get your marks back for Midterm #2 by email. (Your marks were sent to you early Friday morning, November 11.) You can use this bonus assignment to make up for lost marks on your second midterm test. See the assignment for the exact Marking Scheme. Fifteen minute rule =================== Your time as a student is valuable. See the [Week 03 Notes HTML]. Attack on my home web server ============================ From my web log: [Tue Nov 01 10:39:50 2016] [error] [client 189.6.232.191] Invalid URI in request GET /../../../../../../../mnt/mtd/qt HTTP/1.0 Attacks on my servers ===================== As of 2:45am Thursday November 10, 2016. Course Linux Server ------------------- $ fgrep 'refused connect' /var/log/auth.log | awk '{print $NF}' \ | sort | uniq -c | sort -nr | head 56463 (116.31.116.28) # CN, CHINANET Guangdong province network, China Telecom, Beijing 17217 (116.31.116.24) 756 (116.31.116.26) 476 (186.125.213.139) 306 (221.194.47.229) 297 (221.194.47.249) 295 (119.249.54.68) 292 (221.194.47.224) 288 (119.249.54.75) 287 (119.249.54.66) Office machine (same network as CLS) ------------------------------------ $ fgrep 'refused connect' /var/log/auth.log | awk '{print $NF}' \ | sort | uniq -c | sort -nr | head 4698 (116.31.116.28) 2876 (116.31.116.44) 225 (155.133.43.9) 88 (212.129.3.1) 49 (178.162.211.218) 30 (81.171.75.138) 24 (119.249.54.68) 22 (121.18.238.98) 20 (221.194.47.249) 20 (221.194.47.224) Home machine (ISPs: TekSavvy and Distributel) --------------------------------------------- $ fgrep 'refused connect' /var/log/auth.log | awk '{print $NF}' \ | sort | uniq -c | sort -nr | head 7906 (112.85.218.11) # CN, China Unicom, JIANGSU GROUP CO.,NANJING,JIANGSU PROVINCE 6361 (116.31.116.25) 4182 (116.31.116.38) 487 (201.6.243.63) 299 (74.208.205.206) 208 (195.154.60.194) 175 (180.97.220.17) 150 (123.31.35.62) 135 (123.31.34.77) 104 (123.31.34.75) *You're not paranoid if they really **are** out to get you!* ![Take Notes in Class] -- | Ian! D. Allen, BA, MMath - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/ [Plain Text] - plain text version of this page in [Pandoc Markdown] format [www.idallen.com]: http://www.idallen.com/ [Course Home Page]: .. [Course Outline]: course_outline.pdf [All Weeks]: indexcgi.cgi [Plain Text]: week10notes.txt [Week 10 Notes HTML]: week10notes.html [Shell command substituion -- interpolate stdout into a command line using $(...) or \`...\`]: 710_command_substitution.html [Command exit status -- variable $?]: 720_exit_status.html [1]: 730_control_statements.html [List of Commands You Should Know]: 900_unix_command_list.html [Linux and Sysadmin News in the World]: 950_linux_world.html [Video Tutorials on Lynda.com]: 910_lynda_index.html [The VI (VIM) Text Editor]: 300_vi_text_editor.html [Assignment #04 HTML]: assignment04.html [Assignment #06 HTML]: assignment06.html [Assignment #08 HTML]: assignment08.html [Worksheet #08 ODT]: worksheet08.odt [Worksheet #08 PDF]: worksheet08.pdf [Worksheet #08 HTML]: worksheet08.html [Assignment #09 HTML]: assignment09.html [Assignment #10 HTML]: assignment10.html [download Libre Office here]: 050_course_introduction.html#install-libreoffice-or-openoffice-into-windows [Worksheet #06 HTML]: worksheet06.html [NEW Test Instructions]: 000_test_instructions.html [Practice Tests and Answers]: PRACTICE_TEST_README.html [Week 04 Notes HTML]: week04notes.html [Midterm Test #2 PDF]: midterm2_16f.pdf [Week 03 Notes HTML]: week03notes.html [Take Notes in Class]: data/remember.jpg "Take Notes in Class" [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/