The Unix Filesystem

A filesystem is the way that the operating system organizes stored information into files and keeps track of those files. The file is the basic unit of disk storage on a unix system. A file can hold any type of information including text, a program, or digitally encoded music.

On a unix system, all files are organized into directories. A directory is just a special file that stores information about other files. You may find it intuitive to think of a directory as a kind of container that holds files or other directories. Some other operating systems call a directory a folder. The unix filesystem has a hierarchical structure.

At the root of the filesystem is the root directory, written as a slash (/). In this directory are some files (not shown above) and a number of subdirectories such as bin, dev, etc. Each of these subdirectories of / are themselves directories which contain some files and some further subdirectories.

Every file (including directories, which are also files) can be specified in at least two ways. First, there is an absolute path name, which starts with the root and specifies every directory name along the way to the file. An example of this is /home/jbeck/workshop/index.html. All absolute pathnames begin with a leading slash.

Alternatively, you can use a name for a file that is relative to your current working directory. If your current working directory is /home/jbeck and you wish to refer to a file named index.html which is in the subdirectory workshop, you can refer to it as workshop/index.html. Finally, if your current working directory is /home/jbeck/src, you can refer to the file as ../workshop/index.html. The .. means the parent directory of where you are, one level up in the hierarchy. Notice that relative pathnames do not begin with a leading slash.

If most of your computer experience comes from the MSDOS/Windows world, you may notice the lack of drive letters (like C: or A:). In unix operating systems, there are no drive letters. Instead, different drives have different directory names. So /cdrom might refer to he CD-ROM drive and /floppy might refer to what you might normally consider A:. The mount command can show you what ``drives'' you can currently access.