pwd   ls   cd
file   which

Unix Directory Tree

Like any computer, Unix arranges files/directories in an inverted tree topology. The root directory, shown at the top, is written /. It contains several main directories, which you can see using the command ls /. Normally this includes the directories /bin, /home, and /usr. These directories in turn contain subdirectories and ordinary files.

When you log on to a Unix computer, you are initially put into your home directory. Users' home directories are specified in the file /etc/passwd, which you can view (type the command more /etc/passwd).

Special symbols:

/   refers to the root directory
~   refers to your home directory
.   refers to your current working directory
..   refers to the parent directory -- the directory one level up


pwd  At any time, you can type the command pwd to see where on the tree you are currently sitting. (pwd = present working directory)

ls  To list the files located in your current directory, type ls. Useful variations on this command are

cd  To change directory, use the command cd, e.g.,

cd /usr/local
cd             go to your personal home directory
cd ..     move up one level
cd bin     descend one level into subdirectory ``bin'' (assuming it exists)
cd ../lib     move up one level and back down into subdirectory ``lib'' (assuming it exists)

file  Every object represented on disk or in memory is a ``file'', including text files, commands and programs, directories, disks, printers, etc. When in doubt about the identity of something you see with ls, just ask the computer using the file command, e.g.,

file README
file /
file /usr/local/bin/netscape
file /bin/ls

which  The commands you type usually correspond to actual files somewhere on the directory tree. If you are curious, find out where a command is located using the command which, e.g.,

which vi
which netscape
which dir
which which