% CST8207 Week 03 Notes – pathnames, finding files, GLOB patterns % Ian! D. Allen – – [www.idallen.com] % Fall 2014 - September to December 2014 - Updated Wed Sep 24 15:17:53 EDT 2014 Readings, Assignments, Labs, and ToDo ===================================== - Read (at least) these things (All The Words): - [Week 03 Notes HTML] – this file – **Read All The Words** - [Unix/Linux File System and Pathnames (ROOT, absolute, relative, dot, dot dot] - [Directories: ROOT, /root, HOME, /home, and current] - [Searching for and finding files by name, size, use, modify time, etc.] - [Using find -exec or xargs to process pathnames with other commands] - [Shell GLOB patterns (wildcard pathname matching)] - [The VI (VIM) Text Editor] - [List of Commands You Should Know] - Using your [lynda.com] account, watch [Unix for Mac OS X Users] - **3. Working with Files and Directories** - Naming files 5m 41s - Unix is case-sensitive, OSX is case-insensitive! - avoid special characters or blanks in Unix pathnames - use quotes to surround names with blanks or special characters - Creating files 2m 19s - `touch` - Reading files 5m 35s - `cat, more, less` - Reading portions of files 3m 27s - `head, tail` - Creating directories 2m 40s - `mkdir` - Moving and renaming files and directories 8m 32s - `mv` (including using `..`) - Copying files and directories 3m 7s - `cp` - Deleting files and directories 3m 38s - `rm, rmdir` - Searching for files and directories 6m 32s - `find` - **5. Commands and Programs** - Command basics 4m 4s - commands are usually small programs; ways to exit from programs - Using the command history 8m 16s - shell command history is saved your `.bash_history` file Assignments and Lab work 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 #02 HTML] – simple file system commands on the CLS - Coming Soon: Bonus Assignment #03 HTML – the VIM text editor - See the optional tutorial and worksheet, below. - 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 #02 ODT] – Using standard Linux commands - [Worksheet #02 PDF] – Using standard Linux commands - [Worksheet #02 HTML] – Using standard Linux commands - `PS1, cd, find, less, ls, man, mkdir, passwd, pwd, rmdir` - [Worksheet #03 ODT] – Using standard Linux commands - [Worksheet #03 PDF] – Using standard Linux commands - [Worksheet #03 HTML] – Using standard Linux commands - `cat, clear, cp, find, grep, history, less, man, mv, rm, sleep, touch` - [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. - Optional Reading: [The VI (VIM) Text Editor] 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 ======================================== - **Take notes in class!** Your in-class notes would go here. - Turn on “show file extensions” in Windows! No more `file.txt.txt` please. - Review absolute and relative paths as arguments to commands such as `cd` - Finish off absolute and relative pathnames. - GLOB patterns match file names. Errors logging in to CLS ------------------------ I told you in class not to log in with a blank userid, but if you miss class, you don’t hear my warnings and you get locked out: Sep 14 16:53:00 Failed password for invalid user from 184.175.11.38 Sep 14 16:53:12 Failed password for invalid user from 184.175.11.38 Sep 14 16:54:04 Failed password for invalid user from 184.175.11.38 Sep 14 16:54:18 refused connect from 184.175.11.38 (184.175.11.38) Your lack of attendance in classes often results in course failures. The course has five lab periods every week; find one and show up. Errors in submitted `assignment01.txt` -------------------------------------- As of 10:15 Monday the following students have not **Read All The Words** in Assignment 1 and will not be getting marks: xxxx0012: Bad file name: Assignment01.txt xxxx0301: Bad file name: Assignment01.txt xxxx0172: Bad file name: cal.txt xxxx0004: Bad file name: Assigment 01.txt Also, 27 out of 166 students did not label their paragraphs exactly according to the assignment specifications. **Read All The Words** Midterm Test #1 ---------------- - Midterm #1 takes place Friday, October 3 (end of Week 5) in your scheduled lecture hour (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. - There may be more questions on the test than you can answer in the time allowed; answer the ones you know, first. - I will post a set of practice questions and quizzes for the test later this week. Real Sysadmin Work ================== Using parent directory chains to attack a server ------------------------------------------------ Some crackers in Columbia and Hong Kong try to fetch account files from my machine using long strings of parent directories (`..`) in Web URLs: 2013-04-28_03:08:36 190.90.185.241 "GET /help/index.php?screen=../../../../../../../../etc/voipnow/voipnow.conf HTTP/1.1" 404 243 "-" "HTTP_Request2/2.1.1 (http://pear.php.net/package/http_request2) PHP/5.1.6" 332 451 "/var/www/html/help" 2013-02-18_20:46:30 223.255.179.115 "GET /?-d%20allow_url_include%3DOn+-d%20auto_prepend_file%3D../../../../../../../../../../../../etc/passwd%00%20-n/?-d%20allow_url_include%3DOn+-d%20auto_prepend_file%3D../../../../../../../../../../../../etc/passwd%00%20-n HTTP/1.1" 200 541 "-" "curl/7.19.4 (i386-redhat-linux-gnu) libcurl/7.19.4 NSS/3.12.2.0 zlib/1.2.3 libidn/0.6.14 libssh2/0.18" 385 826 "/var/www/html/index.html" $ whois 192.168.9.250 owner: Flywan S.A. address: 000 - Medellin - CO country: CO $ whois 223.255.179.115 descr: Wharf T&T Limited descr: Kwun Tong, Kowloon country: HK Linux in the News ----------------- - [**UK’s security branch says Ubuntu most secure end-user OS**]: *“while no end-user operating system is as secure as they’d like it to be, Ubuntu 12.04 is the best of the lot.”* - Quebec creates a new [Centre of Expertise in Free/Open Source Software] - UK Government now has a clear preference for open source software: > Use open source software in preference to proprietary or closed source > alternatives, in particular for operating systems, networking software, Web > servers, databases and programming languages. > > Problems which are rare, or specific to a domain may be best answered by > using software as a service, or by installing proprietary software. In such > cases, take care to mitigate the risk of lock-in to a single supplier by > ensuring open standards are available for interfaces. > > For unique needs and common problems which have yet to be solved well > elsewhere, develop software by coding in the open and publish under an open > source licence. > > Internet Attacks on my machines ------------------------------- I log attacks on my machines. I compared some attack logs from home (TekSavvy – hit by 32 attack addresses) and my school desktop machine (Algonquin – hit by 50 attack addresses) and found three common attack addresses, two in China and one in India. These three addresses tried to use an SSH login to both my home and my Algonquin machines. Should I worry? 117.21.127.215 196.214.iconpln.net.id 214.51.174.61.dial.wz.zj.dynamic.163data.com.cn From China: $ whois 117.21.127.215 netname: CHINANET-JX descr: CHINANET Jiangxi province network descr: China Telecom descr: No.31,jingrong street descr: Beijing 100032 $ whois 163data.com.cn Domain Status: inactive Registrant: 中国电信集团公司 Registrant Contact Email: domain@chinatelecom.com.cn Sponsoring Registrar: 北京万网志成科技有限公司 - Choose your career! ![The Plans for your Career] ![Read All The Words 2014] ![Read All The Words 2012] ![Take Notes in Class] - [Remember this for later] -- | 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/Linux File System and Pathnames (ROOT, absolute, relative, dot, dot dot]: 160_pathnames.html [Directories: ROOT, /root, HOME, /home, and current]: 170_home_and_HOME.html [Searching for and finding files by name, size, use, modify time, etc.]: 180_finding_files.html [Using find -exec or xargs to process pathnames with other commands]: 185_find_and_xargs.html [Shell GLOB patterns (wildcard pathname matching)]: 190_glob_patterns.html [The VI (VIM) Text Editor]: 300_vi_text_editor.html [List of Commands You Should Know]: 900_unix_command_list.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 [Worksheet #02 ODT]: worksheet02.odt [Worksheet #02 PDF]: worksheet02.pdf [Worksheet #02 HTML]: worksheet02.html [Worksheet #03 ODT]: worksheet03.odt [Worksheet #03 PDF]: worksheet03.pdf [Worksheet #03 HTML]: worksheet03.html [Test Instructions]: 000_test_instructions.html [**UK’s security branch says Ubuntu most secure end-user OS**]: http://www.zdnet.com/uks-security-branch-says-ubuntu-most-secure-end-user-os-7000025312/ [Centre of Expertise in Free/Open Source Software]: http://www.tresor.gouv.qc.ca/nouvelles/article/le-logiciel-libre-est-une-option-incontournable-pour-le-gouvernement-du-quebec/ [The Plans for your Career]: http://sphotos-e.ak.fbcdn.net/hphotos-ak-ash4/225983_476071589080524_1478660289_n.jpg "The Plans for your Career" [Read All The Words 2014]: data/read_all_the_words_white.jpg "Read All The Words 2014" [Read All The Words 2012]: data/lesen_sie.jpg "Read All The Words 2012" [Take Notes in Class]: data/remember.jpg "Take Notes in Class" [Remember this for later]: http://somethingofthatilk.com/index.php?id=293 [Plain Text]: week03notes.txt [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/