Caveat Lector:
These are some notes for a basic course on Unix which I co-taught many
years ago at the University of Calgary. I keep them online in the
hope that they may be useful to someone. However, they are not
maintained. They may contain information specific to one (historic)
network, which will not apply universally. Links may be broken.
[ home ]
These are the example scripts and programs that I used in class.
If you would like to see anything else on this page or have any
questions, email me:
royko@cpsc.ucalgary.ca
Scripts
play:
plays .au files on internal speaker
.logout:
clean up /tmp/ directory
(How would you do this with 'find'?)
dog: similar to cat
rgrep: recursive grep
(How would you do this with 'find'?)
imgidx:
create web page of all images in directory
img.scr:
output of imgidx
C Programs
ls.c:
example of opening named pipes (FIFOs)
ls.scr:
output of 'ls' in /proc/[emacsid]/fd/
ls.scr2:
output of 'ls' in directory with symbolic link
macro.c:
some notes on macros
prof.c:
profiling/debugging example program
(Spawns child process, runs system() calls, etc.
If you can trace through this, you deserve an A in the course.)
prof.scr:
output of profiling example and profiler
(Note flag used in compilation.)
plaind.c:
simple webserver using sockets
(I said I would do this in class, but thought better of it.)
web.scr:
output of above
FAQ
Q1: I was wondering how to
implimment the play program and the other programs as well. I saved it
onto my home directory... do I have to compile it or something to make it
an executable file in my directory?
A1: With shell scripts, all you do is either:
- run the interpreting program, and give the script as input,
so in our case:
%csh play
or
%csh < play
or
- make the script executable, then run it as you would a compiled program:
%chmod 755 play
%./play