Directory Tree (Wiki)

The content of the Security Analogies wiki is now available here, under the GNU Free Documentation License 1.2.

A computer can be thought of like a big library. When you go in through the door, you're in a room, and someone has put a bunch of books here. There are doors leading to other rooms. These doors have labels on them, naming the room. Each of these rooms also contain books.

If I'm going to find a book about the internet, I'm going to go through the door marked "office", and find the book on the bookshelf in there. If I'm after a recipe book, I'd be better off trying to find it near the kitchen.

A computer has a directory tree. It is a way of organizing files on the disk, and it's a lot like the house I just described. At the top level (that's / on unix machines) we've just walked in through the front door. There may be some files here, and those files are the books in the library above. There may be more directories inside those directories, and those are the rooms that lead off the room you're in.

So, why do we call it a tree? A tree is a concept that shows up in Computer Science an awful lot. A tree has bits that split off it, and lots and lots of leaves all over the place. The library has lots of rooms that split off each other, and lots of books all over the place. A directory tree has lots of directories (or folders, on Windows), and files all over the place.

The cunning plan here is to know where your file is going to be by naming our directories and folders according to a system, so that we know where we want to find a file. Each room deeper we go should make the number of books ahead of us much more manageable, until we walk into a room where we only need to look at a few books to quickly find the specific one we need. A quick example: We're looking for a book about coffee. When we arrive at the library, we see doors labeled "Food and Drink", "Machines", "The Chunk Of The Internet Devoted to Photographs of Cats with Faintly Amusing Captions" (it's a big section). We head through the "Food and Drink" door into a room and find more doors: "Hot Food", "Hot Drink", "Cold Food", "Cold Drink". We head through "Hot Drink". We find "Alcoholic" and "Non-Alcoholic" doors, and head through "Not Alcoholic". In this room, we find a book labeled "Everything you ever wanted to know about coffee, and many things you didn't". This is the book we're looking for. Note that if we'd been looking for a recipe for Irish Coffee, we might have had to look in the Alcoholic section. Maybe we need to re-think how we labeled the doors and where we put the books if we start running in to problems like that.

WebSanity Top Secret