Files are the heart of the Unix system. The Unix system knows about three kinds of files: ordinary files, directory files and special files. The programs you create, the text you edit, and all the Unix commands are stored in ordinary files (which we will simply call files). A file is a sequence of bytes. No structure is imposed on a file by the Unix system, and no meaning is attached to its contents. The meaning of the bytes depends solely on the programs that interpret the file.
All files in Unix are organised into directories. A directory is a file containing information about other files and directories; we might think of a directory as a thing which `contains' files and other directories.
When you are given an account on the system, you are assigned a `home directory'. Every time you login you will find yourself positioned in this directory.
Files in the Unix system are grouped into directories and the directories are organised into a hierarchy or tree. The top of the hierarchy is a special directory called the root directory. The root directory contains a variety of system-related files and it usually contains some standard directories such as /bin, /usr, /dev, /etc, and /lib.
Every file has a filename. A filename can be composed of any character except `/' and the null character. You will, however, avoid confusion if you choose characters from the following list.
The only exception is the root directory, which is always named and referred to by `/'. No other file can use this name.
Like children of one parent, no two files in the same directory can have the same name. Files in different directories, like children of different parents, can have the same name.
A filename beginning with a period is called an invisible filename because the command ls does not normally display it. The command ls -a displays all filenames, even invisible ones. Startup files are usually invisible so that they do not clutter a directory. Two special invisible entries, a single and double period (. and ..), appear in every directory. These entries are discussed later.
The files in the current directory are directly accessible; they can be referenced by simply entering their name. Files that are not in the current directory must be referenced by using a pathname. A pathname specifies a path through the file system that leads to the desired file. Paths through the file system can only start in one of two places: your current directory or the root directory. Pathnames that start with the `/' (slash) character are absolute pathnames, specifying a path starting in the root directory. All other pathnames are relative pathnames and they specify a path starting in your current directory.
Every directory (except the root directory) contains entries for the names `.' and `..' These two entries are the glue that holds the file system together. The entry `.' is a pseudonym for the name of the current directory. Programs that want to read the current directory file can use the name `.' rather than scrounge around to determine the name that was given to the directory when it was created.
The name `..' is another name for the parent directory of the current directory. The entry `..' in each directory allows you to specify a pathname that ascends the file system. Notice that all of the other entries in a directory specify files that are at a lower level in the file system hierarchy. You should be comfortable with the ideas behind the names `.' and `..' because you will use these names very often in your interactions with the Unix system.
A few simple rules apply to all pathnames.