A phone directory is a collection of people and their phone numbers. A directory in Linux®
is a collection of files and information about the files. Directories can contain other directo
ries which can contain other directories… and on and on.
So, files are contained in directories and directories are contained in directories. We usually
draw this out for directories like:
topdir `-- middir `-- bottomdir
If we add a file in bottomdir it’ll look like:
topdir `-- middir `-- bottomdir `-- turtles
(For the record, the command tree was used to create these pictures. If it isn’t installed on your system, ask the person who owns it to install it.)
First question: How do we use these things?
Well, the first command is cd. Short for ‘change directory’. You can cd into different direc tories, like:
Alpha:~ computerlamp$ cd topdir
Which will move you down into the directory topdir. Now, for the contents of this directory, try ls:
Alpha:topdir computerlamp$ ls
The output is now:
middir
What if we want to go back to where we were? Well, that means moving up in the directory structure. The directory above us is called the parent, and to move up we do:
Alpha:topdir computerlamp$ cd ..