Department of Geography Computer Labs

Windows and Unix/Linux File and Directory Structure

UNIX/Linux  and Microsoft  Windows XP have similar file structures, that is, the way files and directories are organized on a hard disk. They implement a tree-structure, or hierarchial, file system. A directory can contain any number of files. A directory can also contain other directories.

UNIX file structure:
Directories ("places" to store files) are organized into a hierarchial structure that fans out like an upside-down tree. The top-most directory is known as the root and is written as a forward slash (/). The root can contain many directories, each of which can contain subdirectories; each of these can contain more subdirectories, and so on. A subdirectory is said to be the "child" of the directory that holds it (it's "parent"). The diagram below shows a portion of the file organization on moon, the Department's file server. According to this diagram, there are four directories under the root. The directory data has several subdirectories including moon and everest. The directory moon has two subdirectories, array1 and array2. Directory array2 has two subdirectories, aa and bb. Directory aa has many subdirectories, one for each user who have accounts in the Department. Users have complete control over how they wish to organize their directories and subdirectories.

A pathname is the notation used to point to a particular file or directory; it tells you the path of directories you must travel to get where you want to go. There are two types of pathnames: absolute and relative.

An absolute pathname always starts from the root directory, which is indicated by a slash (/). So, for example, the pathname for the file quiz1.doc is: /data/moon/array2/aa/tbw/courses/G130/quizzes/quiz1.doc.
The first slash indicates that we are starting at the root, and is necessary for indicating that a pathname is absolute. The remaining slashes are delimiters or separators.

A relative pathname points to a file or directory relative to your current working directory. Unless you specify an absolute pathname (starting with a slash) the shell assumes you are using a relative pathname. Starting in your current location (your working directory), you can trace your way up and down the directory hierarchy.

Microsoft Windows file structure:
The file structure is similar to the UNIX file structure. The two main differences are: (1) Microsoft Windows uses a backslash (\) as a delimiter between directory names while UNIX uses a front slash (/); (2) Microsoft Windows storage devices such as hard disks, floppy disks, CDROM's and Zip drives that contain file systems have a drive letter prefix. Floppy drives are typically A: drives, hard disks typically C:, etc. If the quiz1.doc file in the diagram  was located on the C: drive of a PC the path would be:
C:\data\moon\array2\aa\tbw\courses\G130\quizzes\quiz1.doc

Samba is the software that allows Microsoft Windows XP (with its file structure) store and access files on moon, the Department's Unix file server. Samba and our Windows XP network environment are configured so that when you log onto any Windows PC in the Department, your Unix home directory on moon is automatically mapped as the U: drive.

If user tbw logs onto a Windows PC and opens Windows Explorer he can go to his U: drive and see all of the files in his home directory that are stored on moon, the Department's file server. For example, according to the file structure in the diagram on the web page, there are four directories in the tbw home directory (courses, memos, data and todo). Clicking on the U: drive in Windows Explorer would show those four directories.

User tbw could also look at those same directories by using the SSH program on the PC to log onto the Linux computer called earth and then typing the Unix/Linux command "ls -a". The four directories (courses, memos, data and todo) would be displayed as well as some other files and directories to be discussed later.