The idea of a path is popular one with many operating systems. Generally speaking, a path can be defined as a string (that is, a series of characters) that will uniquely identify a file within a system. Paths are different from filenames in that multiple files can have the same name within a system, but a path specifies a particular file. Many programs expect input or provide output in terms of paths.

In the general case of a hierarchical file system, a path is a series of names (or path components) separated by a path delimiter. The delimiter is usually a special character that is not valid within any component. To retrieve the file based on a path, the operating system will start from a point in the file system, and locate the directory (or folder, or what-have-you) that has the name of the first path coomponent. Then, it will find locate the directory within that directory that has the name of the second path component. It will continue as such until either it locates a file, as opposed to a directory, or until there are no more path components.

There are two kinds of paths that are important to distinguish. An absolute path is a true path: it identifies a file unambiguously, and should identify the same file to any process attempting to use it. A relative path identifies a file unambiguously, but only relative to some state of the system beyond what is encapsulated in the path itself. For example, many operating systems maintain a default, or current, directory for each process; relative paths are evaluated beginning at that point rather than beginning at the top of the file system hierarchy. Although conventions differ, frequently an absolute path may be distinguished by beginning with a path delimiter, whereas a relative path will not.


To make things a bit more concrete, let us consider a few particular operating systems.

Unix is the canonical example. Under Unix operating systems, the slash (/) character is the path delimiter. Absolute path evaluation is simple because there is one file system hierarchy. In addition, the special names . (period) and .. (double period) refer to the directory currently being traversed in path evaluation, and the parent (that is, the directory at the previous hierarchy level) of that directory, respectively. There is some ambiguity in the latter of these special terms, because Unix allows symbolic links to directories, and depending on your operating system, shell, and configuration, the "parent" of a directory that has been evaluated through a symbolic link may return the directory through which it was reached, or its physical parent. Here are some examples of Unix path names:

  • /etc/passwd
  • ../bin/grep
  • /home/bob/data/resume.txt
  • ./fsck

MS-DOS and its derivatives base their file system on Unix, but there are many important differences. First of all, they use the backslash (\) character as a path delimiter. Unlike Unix, DOS has a separate file system root for each drive that it has mounted. To refer to a particular mounted drive, you must prefix the path with the unique letter assigned to that drive, followed by a colon. The operating system maintains a current directory for each drive, as well as a current drive. Therefore, both absolute paths and relative paths may or may not specify the drive letter, although clearly absolute paths are really only absolute if they do. Here are some examples of MS-DOS path names:

  • C:\TEMP\SMOOT.TXT
  • ..\BIN\GREP.EXE
  • \AUTOEXEC.BAT
  • A:IBMIO.SYS

The Macintosh operating system, MacOS, does not expose paths to the user, and they are used only within programs and the operating system. It uses a colon (:) as a path delimiter.