Thanks to Andrew Benson for developing these materials!
To access the starter code for these exercises, use the following command:
git clone /afs/ir/class/archive/cs/cs107a/cs107a.1226/WWW/exercises/unix
courses directory contains several quarters (which are directories), each
of which contains several courses (which are also directories).
- Almost all of the courses contains a single file. One doesn't. Which one is it?
- Suppose you're in
courses/aut21/cs103. How could you change directory into
courses/aut21/math19? How about in a single
- The course from part1 has a hidden file inside. What's its name?
p2 (file processing)
wordlist.txt contains...a lot of words. Supposedly it contains all
real English words. I actually don't remember where I got this file. I
downloaded it at some point for use in brute-forcing puzzlehunts.
- Use the
wccommand to count how many there are. (
man wcfor a primer.)
- So it's probably in your best interest not to manually search the file...
- Is "celeriac" a real English word?
- How about "voluter"?
treecommand is a neat way to see the structure of a directory with a bunch of subdirectories. Try it out in the
- If there's a lot of subdirectories,
tree's output can get somewhat overwhelming. Use the manpage for
treeto figure out how to limit the output of
treeto two levels. When run on
courses, the output should contain all course names but none of the files within.
p4 (tab autocompletion)
- There's a file inside the
longnamedirectory. What are its contents? How did you figure it out?
p5 (filesystem manipulation)
recipes directory, you'll see where I've been storing my recipes for
different meals of the day. Help me fix some issues I've been meaning to
address. (If you create any files, you can leave them empty.)
If you mess things up, go back to
recipes and run
./reset.sh. Hopefully it
should get you back to the initial state. Worse-case scenario, reclone this
- Add a new recipe,
- Oops, looks like one of my tax forms got inside the
recipes/lunchdirectory! Delete it. (I have another copy somewhere else.)
- In the future, I might add some non-American recipes for lunch. In
preparation, move the one recipe I have inside
recipes/lunchinto a new directory
- Rename the
dinner. It's too Midwestern for Californians. (Does this affect the contents of the directory?)j
- Oops, there's more tax files inside the [previously]
supper/americandirectory??? And this time it's a whole directory of them. Delete it too. I have copies somewhere, I'm sure.
- Now the [previously]
supper/americandirectory looks kinda empty. Make a copy of the one lunch recipe I had over here. Baked chicken can be eaten for either meal.