Kristian Kvilekval: http://www.cs.ucsb.edu/~kris/cs60 Office: 3158 Engr I DSL Mail: kris@cs Office hours: Wed: 3-5 (CSIL) Fri: 4-6 (CSIL) Overview: Questionaire What's the deal with unix/C Homework Review of commands Review of pathnames Shells (what is it, why so many) Wildcards ---------------------------------------------------------------------- Unix Multiprocess: (compare to multitasking) (compare to mutiprocessor) Robust (process/user protection) Interface for programs (how to a file, a connect to a computer, etc). (Posix, X/open) Where used? Internet, Companies (payroll, operations), File servers, Workstations Windows, Mac : How are they different, How are they similar? Single user Not protected Flakey C 1. Basis of the unix operating. 2. THE language of industry. 3. Used in Applications/Operating systems/networking. 4. Efficient + Relatively portable. C++ 1. A better C 2. (Object oriented -- suitable for large projects) 3. Efficient ------------------------------------------------------- Homework: Hello World: Use xemacs to type in hello world $ xemacs hello.c Compile hello world $ gcc hello.c -o hello Run hello world $ hello Vertical histogram of word lengths: Word length Saving data in array Printing vertically Entab: Keeping track of position ' ' ' bbbbbbbbbbbhi t------>bbbhi Detab: bbbbt-->t-----> ------------------------------------------------------- Commands: cd, pwd, ls, cp, mv, echo, touch, rm, mkdir, du, df, sort, man, cal, xemacs grep,fgrep, w, who, ps, which, uptime Pathnames Full Qualified /, /bin/ /home/kris Relative path work, ./work, ../../work Shell: Origin of name? Commands interpreter -- Interactive Program language (batch file?) Lot's of shells: sh, csh, tcsh, ksh, bash Commands (2) Shell commands + Programs Shell commands !Depends on Shell used! (set, cd, setenv, alias) Adding new dirs to directory? Wildcards: (shell program) %ls *.sh %ls hmwk* %ls hmwk? %ls hmwk[0-9] Commands? What are they? Input --> Processing --> Output Keyboard --> Commands --> Screen How about Keyboard --> Command --> File Or File --> command --> screen Input/Output redirection % ls -1 > list % spell < resume.txt Also allowed to tie program with a 'pipe' command --> command --> screen %ls -1 | more %fgrep money account.txt | more Job Control: What goes in background (things that don't need the keyboard or screen RIGHT now) Putting things in background ctrl-Z then bg command & Checking background jobs % jobs % ps Forground (giving command control of keyboard and screen) % fg %1 Long running or uninteresting jobs %rm -rf junk & How about emacs or more (what happens) % emacs &