NOTE: this website is under construction for the new quarter. Please pardon our dust! The content of this website is subject to change as we put together resources for the new quarter. If you are a student who took the course last quarter, you should visit last quarter's class web site instead, accessible by visiting this link.
Written by Chris Gregg, with modifications by Nick Troccoli
Click here for a walkthrough video.
If you need to find a file in a particular directory, you can use the find command, which has a somewhat strange syntax:
$ pwd
/afs/.ir/users/c/g/cgregg/cs107/assignments
$ find . -name "hello.c"
./assign0/hello.c
./assign1/hello.c
$
The first argument (. above) is the directory you want to search (i.e., the current directory in the above search). This can be any directory:
$ find assign1 -name "hello.c"
assign1/hello.c
$
The second argument, -name means, "search for the name", and the final argument ("hello.c"), which is normally in quotes, gives the name to search for. This is different from grep, which searches for text within files. find also uses a slightly different wildcard than grep, so you can search for patterns like this (to search for all .c files):
$ find . -name "*.c"
./assign0/hello.c
./assign1/folder1/myProgram.c
./assign1/hello.c
./assign3/loop.c
$
The find command has a vast number of options; take a look at the man pages for more information.