Spring 2000
CS114: Unix Tools
Announcements  |   Homework  |   Advanced Track
Instructor David I. Schwartz
5137 Upson Hall
Office Hours: 3-5 MWF
Consultants Anwar (apk4@cornell.edu)
Vikash  (vrg3@cornell.edu)
Information News: cornell.class.cs114
Web:  http://courses.cs.cornell.edu/cs114/2000sp/
Archive: http://www.cs.cornell.edu/cucs/courses_degreeprogs/archive.htm
Links: http://www.cs.cornell.edu/dis/unix.htm
Grading All homework graded on scale of 0-4.
You must maintain a 75% average (a "3") to pass.
Textbooks UNIX for Programmers and Users, G. Glass&K.Able, Prentice Hall, 1999.
Introduction to UNIX, D. I. Schwartz, Prentice Hall, 1999
UNIX in a Nutshell, A. Robbins, O'Reilly, 1999
Syllabus 2/21-2/25: Read chaps 1-4 in DIS, 1-2 in G&A
2/28-3/3:  Read chaps 5-8 in DIS, 2-3 in G&A
3/3-3/10:  Read chap 7 DIS; 3-4, 6, 11 in G&G

5/17 grades are in! yes, we did finish grading -- the assignments were all very good and got mostly 3s and 4s. The consultants logged the grades on grading sheets but didn't mark the papers. I skimmed thru the entire pile. I will leave it in 303 Upson if you wish to pick up your old work.
3/26 partners for project yes, but it's got to be REALLY good if you have a partner
3/17 babbage problems Please don't email that babbage is or was down. If you aren't able to hand in your HW3 today, you should hand it on Mon 3/27, but you'll be docked 25% for being "1 day" late.
grades We haven't collected info yet. I will post an update on this website. I can't promise that I can respond to email, so please be patient.
3/14 bash! ADM reports that bash is now safe for your default login shell.
3/13 Due dates changed Due to popular demand (from those in lecture), HW3 is due 5PM Friday 3/17. The project is due the Monday after Spring Break (3/27). I will give "bonus points" to anyone who submits anything early.
How to submit HW3 and Project Submit printouts.
3/12 HW3 extension HW3 is now due Weds 3/15. 
Flow of files Inside ~dis9/Scripts/: info -> comments -> basic -> variables -> output -> input -> quotes -> commandline -> arithmetic -> exitting -> condition -) (more to come)
3/10 free examples I posted a collected examples inside ~dis9/Scripts/. I'll place the "order" the examples follow in the README file soon. Keep posted -- I will post more examples for the rest of the semester
3/9 updates I've answered a few questions I've gotten in the assignments below. Look for the New portions.
3/6 bash I strongly recommend against choosing bash as your default shell on babbage. You may not be able to log in again. ADM knows about the problem and asks that you not change to bash.
3/5 HW2 the filenames you copy into your account must be uppercase. I fixed the assignment below.
3/3 syllabus see the Syllabus above for new readings
3/1 HW2 I'm going to extend the due date of HW2 to Mon 5PM, just in case we don't cover enough on file management. You should be reviewing info on copying, moving, changing permissions on files. See also making and changing directories. For DIS, review chaps 3, 5-6, and first half of 8.

2/21 HW1
Due 2/25
The basics:
  • Use mailx on babbage.csuglab.cornell.edu. Due Friday 2/25 5PM
    • Subject Line: CS114, HW1, ID
    • Body: why you are taking CS114
  • Students A-M, email Anwar (apk4@cornell.edu)
  • Students N-Z, email Vikash  (vrg3@cornell.edu)
2/25 HW2
Due Mon
3/6 5PM
File Management:
  • Enter my account: dis9 on babbage.
  • Copy the files a1.txt, a2.txt, b1.txt, b2.txt, c1.txt, and c2.txt to your
  • home directory on Unix. Beware! I "scattered" all six files in my account. You will need to go "digging" around to find them. Hints: I might have "hidden" a directory. I might have used "special" characters, also.
  • Edit all six files: Change the word "original" to "changed" inside each file. Use vi, vim, or emacs.
  • Rename each file to be all uppercase letters, except the .txt extension.
  • Create a series of subdirectories with the structure ~/Unix_work/A/B/C/. Refer to dis9 for a demonstration of the exact structure you need. (Yes, C/ goes into B/ goes into A/ goes into Unix_work/.)
  • Place files A1.txt and A2.txt, inside the A/ subdirectory. Place B1.txt and B2.txt inside B/. Place C1.txt and C2.txt inside C/. Yes, you must rename the files to be uppercase as in A1. txt, B1.txt, etc.
  • Follow the instructions in Chapter 8, Section 8.3 in DIS to set correct premissions. Don't forget to set permissions on your home account!
The graders will check to see if you correctly copied and edited all files in your account. If you do not set permissions on ALL appropriate directories and files, the graders cannot "see" your work! How should you test? Consult with a classmate.
3/6 HW3
New: Due
3/15 5PM
Write a script for performing a "global mv" called gblmv. This script will change the file extension of every file with a given extension to another extension. For example, if you had 5 files in the same directory with the extension ".java," this script would change each to ".txt" or any other extension the user requests. This script must also handle cases if the user enters the same extension or requests removing all extensions. Use any Unix scripting language you prefer. New: Put the scrip[t in a subdirectory of HOME called HW3. Be sure to set correct permissions. New: check out dirname and basename.
3/17 Project
New: Due 3/27
(DIS's office)
End of the semester project:
  • New: Yes, you may use a "friendly editor."
  • Keep track of the variety of "tools" discussed in lecture and assignments. Use man, notes, and reference material.
  • The report should organize the tools by CATEGORY (file management, identity, communication, programming, system/internet access, USENET, help, etc -- more categories will be provided as the semester progresses.
  • For each tool, provide an alphabetical list with command name, description, example(s).
  • You do not need to demonstrate options, though doing so might clarify a tool's usage. (Giving options is strictly optional!) See the command summary at the back of the DIS book for an example format. Also, check out Unix in Plain English (might be in book store?) for a similar effort.
  • Commands to summarize:  man, file, vim, view, cd, ls, ln, mv, cp, pwd, echo, exit, logout, more, less, vi, emacs, kill, ps, fg, bg, jobs, stop,  notify, wait,  sleep, nohup, crontab, at, batch, news, who, listusers, rusers, finger, su, w, rwho, users, whois, mail, mailx, talk, mesg, send, hostname, host, ping, telnet, rlogin, rsh, ftp, uuencode, uudecode, uucp,  find, grep, egrep, fgrep, comm, diff, diff3, dircmp, cmp, sort, uniq, troff, col, cut, head, tail, split, spell,  compress, uncompress, tar, gzip, pack, unpack, zip, unzip, pg, cat, join, touch, uname, set, alias, setenv, stty, zmore, zdiff, chmod, umask, groups, chown, du, df, quota, yes, banner, cal, calendar, date, ed, ex, env, from, folder, gs, history, ispell, last, look, login, lp, lpr, lpstat, lpq, mkdir, rmdir, rm, paste, ps2ascii, ps2pdf, time, type, which, whence, timex, unalias, dis (yes, there is indeed a dis command)
  • Example format:
  • Category Command Description Example
    File Managment ls [-alF] path
    list files
      list all files
      long listing
      list files and types
    ls -l
    ls -al
    ls -aF
    ls -a ~/
    rm [ -ir] path
    remove/delete files
      interactive remove
      recursive remove
    rm test
    rm -i test
    rm -ir Data/

Advanced Track
The following assignments involve commands that a more experienced Unix user should know.
All assignments have the same due date as standard CS114 assignments.
HW1 Same
  • Configure your account for tcsh or  ksh (beware that bash might be buggy!)
  • Use environment variables and aliases for a variety of tools you find useful.
  • Explain your setup in a file called CS114_README inside your HOME.
  • Set your permissions so that the consultants can view your files.
  • HW3 Write a Perl script:
    • The purpose of this script is to analyze the correctness of a Java program sent by email. The script will assume that the program is included in the body of the email. The script "records" information in a text file called grades.txt:
      • The script will record the username of the sender from the "From:" portion of the email.
      • The script will record the person's actual name from the first comment line of the program that will appear as // Name: <student name>.
    • The script will strip out the entire code, then compile and run it using the command javac filename.
      • If the file does not compile, the script records a grade of zero for the student.
      • If the file compiles, the script will compare output from the code with a file containing the correct output. In this case, a grade of 2 is recorded.
    • The script then mails back a message to the user reporting the success or failure.

    • Students may only get 2 chances to activate the script.
    Project Same