----------------------- Lab #01 for NET2003 due January 15, 2008 (Week 2) ----------------------- -Ian! D. Allen - idallen@idallen.ca Remember - knowing how to find out an answer is more important than memorizing the answer. Learn to fish! RTFM! (Read The Fine Manual) Global weight: 1% of your total mark this term. Due date: before 14h00 (2pm) Tuesday January 15 (Week 2) The deliverables for this exercise are to be submitted online on the Course Linux Server using the "netsubmit" method described in the exercise description, below. No paper; no email; no FTP. Late-submission date: I will accept without penalty exercises that are submitted late but before 14h00 (2pm) on Thursday, January 17. After that late-submission date, the exercise is worth zero marks. Exercises submitted by the *due date* will be marked online and your marks will be sent to you by email after the late-submission date. Exercise Synopsis: The "vi" or "vim" text editors are the most common on Unix/Linux. You will use "vim" to create a text file, read in another file, perform some simple edits, and save and submit the results. Where to work: Do your Unix command line work on the Course Linux Server via remote SSH (secure shell) login to TCP port 22. The server IP address is: 10.50.254.148 This server is accessible inside the Algonquin College firewall, or from home via the Algonquin VPN. Use your 8-character Algonquin userid. See Ian! (not ITS) for password problems on the Course Linux Server. ITS does not maintain this server. The files you work on will remain on the server even after you log off. Do not erase your files after submission; always keep a spare copy of your exercises. WARNING: Do not attempt this exercise on a Windows machine - the text file format is different. You must connect to and work on Unix/Linux. Note that you may connect to the Course Linux Server *from* a Windows machine (using PuTTY); however, you may not use the Windows machine itself to do your work. Use the vim editor on the Course Linux Server. Easy access to Course Notes: Location of the course notes on the Course Linux Server: You can find a copy of all the course Notes files on the Course Linux Server under directory (note the leading tlide character): ~idallen/public_html/teaching/net2003/08w/notes/ You can copy files from this directory to your own account for modification or study: $ cp ~idallen/public_html/teaching/net2003/08w/notes/README.txt foo.txt (To avoid academic fraud or plagiarism charges, you must credit any material that you copy and submit unchanged.) Know where to find an online copy of all the course Notes on the Course Linux Sever. --------------------------------------------- Exercise Details (on the Course Linux Server) --------------------------------------------- Part I - Learning VIM on the Course Linux Server ------ VIM is a widely-used, open-source, command-line text editor. Anyone doing work on a Unix/Linux machine needs to learn it. VIM is "easy to use; but, hard to learn". Practice makes it easy! Students who neglect to learn how to use VIM effectively usually fail to complete online lab tests. You need to know this editor. Reference: "man vim" and http://www.vim.org/ 1. Complete the eight lessons of the VIM Tutorial 1.7 on the Course Linux Server. Start with a terminal window that is 25 lines by 80 columns, then log in to the server (using ssh) and type this command at the shell '$' prompt: $ vimtutor See also the Class Notes files: vi_basics.txt vi_refcard_*.pdf Any questions? See me in a lab or post questions to the Class Mailing List (on the top left of the Course Home Page). Hint numbers in this lab are based on VIM Tutorial Version 1.7. An extra copy of vim_tutorial_1.7.txt is in the Course Notes. 2. Edit your .vimrc file (created in Lesson 8) and add "set confirm" underneath the line containing "set incsearch". Part II - Using VIM on the Course Linux Server ------- 3. Using VI/VIM, edit a new, empty file named lab01edit.txt on the Course Linux Server. The spelling of the file name must be exact, othewise it won't be marked. The spelling must be exact. Exact! 4. Put the full absolute pathname of the Class Notes vi_basics.txt file (on the Course Linux Server) as the first line of the new lab01edit.txt file. It will be the only line in the file. (Absolute pathnames start with a slash in Unix.) 5. Follow the above pathname with a blank line in the file. Save the file. 6. From the file opt_why_shell.txt in the Notes directory use VIM (not your mouse!) to read and extract just the one 16-line paragraph that starts with the words "Back in" and put it in a file named: lab01backin.txt Notes: Use a new VIM session to read the entire Class Notes opt_why_shell.txt file into VIM, edit away the unnecessary lines, then write it out with the new name. Do not change the indentation, spacing, or formatting of this 16-line paragraph. Do not use a mouse-based copy/paste. Use the VIM command that reads in a file at the current cursor position (VIM tutorial Lesson 5.4) and the command that writes out (saves) the current file to a new file name (VIM tutorial Lesson 5.2, 5.3). 7. Re-edit your lab01edit.txt file. Use VIM to read a copy of lab01backin.txt (the one 16-line paragraph) into the bottom of your exercise submission file: lab01edit.txt 8. Make sure a single blank line separates the above paragraph from the text above it in the lab01edit.txt file. 9. Note the start and end line numbers of this single paragraph and use a single VIM command to globally change *all* occurrences of the three characters "and" to "***" in this paragraph only. (VIM tutorial Lesson 4.4.) Change *all* occurrences on each line. Do not make these changes one-by-one; use the global search and replace substitution command (Lesson 4.4). 10. Submit the files (see below). Submission ---------- Submission Standards: A. At the top of the lab01edit.txt file create an Exterior Assignment Submission label following the example you will find under the "Assignment Standards" button on my teaching home page at http://teaching.idallen.com/ . (The Teaching home page is not the same as the Course home page.) For full marks, follow the directions for the label exactly. The label has exactly 7 lines, plus an optional Comments line. The spelling of the label fields on the seven lines must be exactly as shown (machine readable). The spelling must be exact. Exact! B. Using the netsubmit command: Reference Class Notes file: netsubmit.txt Submit these files for marking as Exercise 01 using the following *single* netsubmit command line exactly as given here: $ netsubmit 01 lab01edit.txt lab01backin.txt .vimrc This "netsubmit" program will copy the selected file(s) to me for marking. Always submit all your files at the same time. Do not delete your copies; keep them. C. Verify that you submitted all your files, using this command line: $ netsubmit 01 -list Note that the digit '1' and the letter 'l' (lower-case 'L') are different. The digit '0' and the letter 'O' are also different. Do not confuse these characters on your screen. You may redo this exercise and re-submit your results as many times as you like; but, you must always submit *all* your exercise files every time. The "-delete" option of netsubmit will delete the most recent submission you have made. I will mark only the most recent submission that is submitted before the final hand-in cutoff date. For Exercise 01, always use "01" as the first argument to "netsubmit". Always submit *all* the files each time you submit an exercise. P.S. Did you spell all the assignment label fields and file names correctly?