% CST8207 Week 06 Notes – I/O redirection; Midterm Test #1 % Ian! D. Allen – – [www.idallen.com] % Winter 2015 - January to Apil 2015 - Updated Tue Feb 10 12:56:40 EST 2015 Readings, Assignments, Labs, Tests, and ToDo ============================================ - Read (at least) these things (All The Words): 1. [Week 06 Notes HTML] – this file – **Read All The Words** 2. [Unix Shell I/O Redirection (including Pipes)] 3. [List of Commands You Should Know] 4. [Video Tutorials on Lynda.com] - Create your [lynda.com] account and watch [Unix for Mac OS X Users] - **6. Directing Input and Output 20m 39s** - Standard input and standard output 1m 24s - Directing output to a file 4m 13s - Appending to a file 2m 44s - Directing input from a file 5m 28s - Piping output to input 4m 40s - Suppressing output 2m 10s - **7. Configuring Your Working Environment 41m 28s** - Setting command aliases 6m 59s - saving aliases in your `.bashrc` file Assignments this week --------------------- Check the due date for each assignment and put a reminder in your agenda, calendar, and digital assistant. - Read All The Words, Do, and then Submit via Blackboard: - [Assignment #03 HTML] – working with files: `PS1, find, mkdir, mv` - Bonus (optional) [Assignment #04 HTML] – the VIM text editor - [Assignment #05 HTML] – using GLOB patterns and redirection - Really do **Read All The Words**. You don’t get a second chance to get it right. ### 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 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 #04 ODT] – shell GLOB patterns and Aliases - [Worksheet #04 PDF] - [Worksheet #04 HTML] - shell GLOB patterns (wildcards), Aliases: `alias, sum, unalias` - [Worksheet #05 ODT] – shell I/O redirection (including pipes) - [Worksheet #05 PDF] - [Worksheet #05 HTML] - shell I/O redirection, `date, head, nl, tail, tr, wc` - [Worksheet #06 ODT] – *Optional* Bonus VIM Text Editor Practice - [Worksheet #06 PDF] - [Worksheet #06 HTML] - This is an *optional* worksheet for a BONUS assignment using `vim` - Optional command-line VIM tutorial: the `vimtutor` program on the CLS. - Optional Reading: [The VI (VIM) Text Editor] - Bonus (optional) [Assignment #04 HTML] – the VIM text editor Lab work this week ------------------ - Bonus (optional) [Assignment #04 HTML] is ready - [Assignment #05 HTML] is ready - Finish the above assignments, which involve work on the worksheets. Upcoming tests and quizzes -------------------------- Read the [Test Instructions] (all the words) before your first midterm test. 1. First Midterm test: 45 minutes; in class 8am Thursday in Week 6 (February 12) 2. First Quiz is posted (based on first Practice Test). 3. Second Midterm test: 45 minutes; in class 8am Thursday in Week 9 (March 12) Tests take place in your 8am lecture hour, not in your lab period. ### Midterm Test #1 - Midterm #1 takes place 8am Thursday February 12 (Week 6) in your usual scheduled 8am lecture hour and classroom (not in your lab period). - For full marks, you must read the [Test Instructions] before the test for important directions on how to enter your answers, your lab (not lecture) section number, and the test version number on the question sheet and the mark-sense forms. - This test, and all the tests, are closed book, no aids, no computer. (You won’t have a cheat sheet at your job interview, either.) - There may be more questions on the test than you can answer in the time allowed; answer the easy ones you know, first. - A set of practice questions and answers for the first midterm test is posted: [Practice Tests and Answers]. The test content will be taken largely from this set of practice questions. - Blackboard has some quizzes taken randomly from the practice test. See the [Week 05 Notes HTML] for details on the quizzes. From the Class Notes link on the Course Home Page ================================================= - Review last week. Did you do everything assigned last week? From the Classroom Whiteboard/Chalkboard ======================================== - This week, we finish I/O redirection and review for the midterm test. - Students who did not change their passwords (see [Assignment #02]) have had their CLS accounts disabled. - Due date changes for [Assignment #04] and [Assignment #05]. - I’ve written information on [Automatic Backups on the CLS] that explains how to get back a file you’ve deleted or changed. - I wrote a new web page on [using `awk` to select fields]. - The [VI Text Editor][The VI (VIM) Text Editor] creates hidden recovery files as you edit that can get included in recursive path listings: `.*.swp` - [Verify your GLOB patterns before you use them] - Don’t use strange commands and/or options you find on the Internet. Stick with the commands in the web notes and assignments and listed in the weekly notes under [List of Commands You Should Know]. - Don’t [help other students fail the course]! Missing lectures: save one hour to spend three ---------------------------------------------- Students who save an hour by not attending a lecture usually end up spending three hours trying to answer assignment questions that I gave the answers to in the lecture. Work smarter. Fifteen minute rule – REMINDER ------------------------------ **READ THIS:** This is a repeat of what I told you back in [Week 3]: Your time as a student is valuable. If you come up against a tough problem and make no progress in fifteen minutes despite your best efforts: 1. get help from a professor or lab instructor 2. get help from classmates 3. take a break 4. put it on hold and work on something else This happens to all of us, and we need to watch out for it when it happens. Be especially careful if you find yourself trying to solve a problem with online searches, since those searches will return answers irrelevant to the assignment. Read and search the course notes; don’t waste time searching the entire Internet. Wasting your time with online searches -------------------------------------- I watch students trying to solve assignment problems using online searches for answers. They may end up using commands we haven’t even covered yet: > Sorry, I dont know what `sudo` does; was getting help online to find files. If you look at the [List of Commands You Should Know] that is given in the weekly readings every week, you will see that we haven’t covered the `sudo` command yet, so you should not be using it. Don’t use commands that you haven’t learned yet. Also, you must never use any command that you don’t understand, even if you get it from the course notes or a worksheet. You risk deleting all your files if you use commands you don’t understand. If you use online help, you will find thousands of complex wrong ways to do things. If you read the course notes, not **Google**, you will find a simple, right way. You only need to use the commands we’ve learned so far in the course notes and the worksheets. That is all. Why take notes in class? ------------------------ - **Take notes in class!** Your in-class notes would go here. - [Do your class notes look like this?] A student writes: > But for the note taking, I personally find that without my laptop in front > of me I am more focused on the teacher. Also with taking the notes by hand > I find that the information that is presented to me in the lectures is > remembered much easier. > > But I do have my ipad in front of my with the class notes. This also helps > me follow along with the examples that you present in class. > > Also sometimes I read over the class notes after the class and fix my notes > with anything that was missed. - [Does your Linux notebook look like this?] Real Sysadmin Work ================== Locked out of Course Linux Server --------------------------------- I told you not to try to log in to the CLS with a blank userid. Now your home IP address is locked out from the CLS: Feb 6 14:29:24 Accepted password for XXXXXXXX from 174.95.88.168 Feb 6 14:56:59 Invalid user from 174.95.88.168 Feb 6 14:57:07 Failed password for invalid user from 174.95.88.168 Feb 6 14:57:14 Failed password for invalid user from 174.95.88.168 Feb 6 14:57:32 Failed password for invalid user from 174.95.88.168 Feb 6 14:57:47 Failed password for invalid user from 174.95.88.168 Feb 6 14:57:57 Invalid user from 174.95.88.168 Feb 6 14:58:16 Failed password for invalid user from 174.95.88.168 Feb 6 14:58:49 Failed password for invalid user from 174.95.88.168 Feb 6 14:58:52 Failed password for invalid user from 174.95.88.168 Feb 6 14:58:59 Failed password for invalid user from 174.95.88.168 Feb 6 14:59:07 Failed password for invalid user from 174.95.88.168 Feb 6 14:59:11 Failed password for invalid user from 174.95.88.168 Feb 6 14:59:25 refused connect from orlnon0604w-lp130-04-2925484200.dsl.bell.ca (174.95.88.168) Don’t do that. Here is an attack from a local Ottawa IP address: Feb 6 21:36:58 Invalid user admin from 67.210.172.117 Feb 6 21:37:00 Failed password for invalid user admin from 67.210.172.117 Feb 6 21:39:23 Invalid user guest from 67.210.172.117 Feb 6 21:39:25 Failed password for invalid user guest from 67.210.172.117 Feb 6 21:41:48 Invalid user info from 67.210.172.117 Feb 6 21:41:50 Failed password for invalid user info from 67.210.172.117 Feb 6 21:44:14 refused connect from 67.210.172.117 (67.210.172.117) If that’s you, you need to review your [Course Linux Server] login notes. I did not re-enable this IP address; you have to contact me. Attacks on the Course Linux Server ---------------------------------- - Count the attacks: `fgrep -c "refused connect" /var/log/auth.log` - Another way to count the lines (less efficient): `fgrep "refused connect" /var/log/auth.log | wc` - Only show the last 10 lines: `fgrep 'refused connect' /var/log/auth.log | tail` - See the current list of *evil* host IPs: `less /etc/hosts.evil` * * * * * ![Take Notes in Class] -- | Ian! D. Allen - 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/ [Unix Shell I/O Redirection (including Pipes)]: 200_redirection.html [List of Commands You Should Know]: 900_unix_command_list.html [Video Tutorials on Lynda.com]: 910_lynda_index.html [lynda.com]: http://algonquincollege.com/onlineresources/mobileStudent/lynda.htm [Unix for Mac OS X Users]: http://www.lynda.com/Mac-OS-X-10-6-tutorials/Unix-for-Mac-OS-X-Users/78546-2.html [download Libre Office here]: 050_course_introduction.html#install-libreoffice-or-openoffice-into-windows [The VI (VIM) Text Editor]: 300_vi_text_editor.html [Test Instructions]: 000_test_instructions.html [Practice Tests and Answers]: PRACTICE_TEST_README.html [Automatic Backups on the CLS]: 070_course_linux_server.html#automatic-backups-on-the-cls [using `awk` to select fields]: 187_selecting_fields_awk.html [Verify your GLOB patterns before you use them]: 190_glob_patterns.html#verifying-glob-patterns-before-using-them [help other students fail the course]: 050_course_introduction.html#plagiarism-and-working-together [Week 3]: week03notes.html#fifteen-minute-rule [Do your class notes look like this?]: data/kf_link_redirect.png [Does your Linux notebook look like this?]: data/rn_notebook.jpg [Course Linux Server]: 070_course_linux_server.html [Take Notes in Class]: data/remember.jpg "Take Notes in Class" [Plain Text]: week06notes.txt [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/