% CST8207 Week 04 Notes - file GLOB patterns, Redirection, Pipes % Ian! D. Allen - idallen@idallen.ca - www.idallen.com % Winter 2013 - January to April 2013 - Updated Wed May 8 21:01:24 EDT 2013 Readings, Assignments, Labs, and ToDo ===================================== - Read (at least) these things (All The Words): - [Week 04 Notes HTML] - this file - ** Read All The Words ** - [Shell GLOB patterns (wildcard pathname matching)] - [Unix Shell I/O Redirection (including Pipes)] - [List of Commands] - From “Unix for Mac OS X Users” at [lynda.com] - **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 - Read (All The Words), Do, and save (not for hand in) - [Lab Worksheet #02 HTML] - [Lab Worksheet #03 HTML] - Read (All The Words), Do, and then Submit via Blackboard: - [Assignment #02 HTML] - [Course Linux Server] - [Assignment #03 HTML] - practice with basic commands - **READ ALL THE WORDS** Assignment 2 preliminary marks ------------------------------ 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 9 10 12 12 12 12 12 12 12 12 12 12 13 14 14 14 16 16 19 19 19 20 21 21 21 21 21 21 22 23 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 Midterm Test #1 - Week 5 - Thursday February 7 - 15% ===================================================== - Midterm test dates are posted on the [Course Home Page]. - Midterm Test #1 (Thu Feb 7) covers these notes and readings: - [Week 02 Notes HTML] - [Lab Worksheet #02 HTML] - [Assignment #02] - [Week 03 Notes HTML] - [Lab Worksheet #03 HTML] - [Assignment #03] - See the [Practice Test #1 PDF] and answer file in the [Class Notes]. - For full marks, you must read the [Test Instructions] before the test for important directions on how to enter your answers, your lab 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. 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 ======================================== - Your in-class notes go here. - First Midterm test date: Thursday February 7 3pm (Week 5) - Please send me a copy of the [Rap Video] … Some Commands ============= Keep a notebook with a [List of Commands] in it: - `cat file` vs. `ls file` vs. `find dir -name 'file'` - `clear` - or use the sysadmin lazy way to clear the screen instead - `grep (-i, -v, -e)` - we are not handling regular expressions (`grep` patterns) this term - `hostname` - `ls (-l, -i, -s, -a, -b, -p)` - meaning of the output fields - `rm` vs. `rmdir` vs. `rm -r` - `sleep` - `touch` - `whoami` Long listing from ls -------------------- Know the meaning of each of the output fields of **`ls -dils`**: 2 4 drwxr-xr-x 24 root root 4096 Sep 12 12:12 / 2883589 4 drwxr-xr-x 2 root root 4096 Oct 5 02:05 /bin 2883666 104 -rwxr-xr-x 1 root root 105776 Feb 23 2011 /bin/ls 2883587 12 drwxr-xr-x 186 root root 12288 Oct 17 13:38 /etc 2889578 4 -rw-r--r-- 1 root root 2209 Mar 19 2012 /etc/passwd 1. inode number 2. size in disk blocks 3. (one char) type (file, directory, symlink, etc.) 4. (9 chars) permissions (3 for user, 3 for group, 3 for other) 5. link count (count of names for this inode) 6. userid of owner 7. userid of group 8. size in bytes (characters) 9. date last modified 10. name Shell GLOB patterns (wildcard pathname matching) ================================================ - [Shell GLOB patterns (wildcard pathname matching)] Unix Shell I/O Redirection (including Pipes) ============================================ - [Unix Shell I/O Redirection (including Pipes)] Point-and-Grunt and Free Software Ideals ======================================== - Eben Moglen on the GUI as a catastrophe - - [2m30s] “I wrote an internal appreciation about that computer [the Apple Lisa] in which I said this is a catastrophe. This is the end of language in relation to computers. This is the implementation of the”cave man" interface: you point, and you grunt. And if we reduce the interaction between human beings and computers to pointing and grunting, then we miss the role of language in the evolution of human mind and human consciousness. Language is what makes our brains bigger. If we don’t use languages to relate to computers, neither their brains nor our brains will grow in the way that they are supposed to grow." – Eben Moglen, [Free Software Foundation] - Bruce Byfield on software freedom - - […] in the rush for market share, many people seem to lose sight of the fact that the goal of GNU/Linux and free software is not popularity in itself, but the wide acceptance of a set of ideals. At its most basic, free software is about helping users gain control of their computers so that they can participate unhindered in the digital conversations of the networks and the Internet. It’s about installing software freely, rather than being dictated to by the manufacturer. It’s about using your computer the way that you want, instead of ceding control to lock-down devices installed by software vendors without permission on your machine. – Bruce Byfield, http://itmanagement.earthweb.com/osrc/article.php/3733286 Real Sysadmin Work ================== - Using the sleep command to delay an action: I was rebuilding a RAID1 array, and needed to temporarily stop the nightly disk-scan job, so that the RAID1 rebuild could finish on time. I used the estimated time to schedule a restart of the disk-scan 80 minutes from now, so that I wouldn’t forget: # kill -STOP 22768 # cat /proc/mdstat md3 : active raid1 sda4[2] sdb4[1] 1441603520 blocks [2/1] [_U] [==================>..] recovery = 91.2% (1316017856/1441603520) finish=62.2min speed=33644K/sec # ( sleep 80m; kill -CONT 22768 ) & # exit - Checking student account directories and mail spool files: # ls /home | wc # ls -d /home/* | wc # ls -d /home/???????? | wc # LC_COLLATE=C ; export LC_COLLATE # strict ASCII sorting in ranges # ls -d /home/[a-z][a-z][a-z0-9][a-z0-9][0-9][0-9][0-9][0-9] | wc # ls -d /var/mail/[a-z][a-z][a-z0-9][a-z0-9][0-9][0-9][0-9][0-9] | wc - Checking student assignments: # ls -d /home/[a-z][a-z][a-z0-9][a-z0-9][0-9][0-9][0-9][0-9]/CST8207-13W -- | 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 [Shell GLOB patterns (wildcard pathname matching)]: 190_glob_patterns.html [Unix Shell I/O Redirection (including Pipes)]: 200_redirection.html [List of Commands]: 900_unix_command_list.html [lynda.com]: https://lyceum.algonquincollege.com/Lynda [Lab Worksheet #02 HTML]: worksheet02.html [Lab Worksheet #03 HTML]: worksheet03.html [Course Linux Server]: 010_course_linux_server.html [Practice Test #1 PDF]: practicetest1.pdf [Class Notes]: indexcgi.cgi [Test Instructions]: 000_test_instructions.html [Rap Video]: 000_rap.html [Free Software Foundation]: http://ww.fsf.org/ [Plain Text]: week04notes.txt [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/