Absolute Pathname Definition

An absolute pathname, also referred to as an absolute path or a full path, is the location of a filesystem object (i.e., file, directory or link) relative to the root directory.

The root directory is the directory at the very top of the hierarchy of directories (also referred to as the directory tree) that comprises the filesystem on Unix-like operating systems. It contains all other directories and their subdirectories, etc., and it is designated by a forward slash ( / ).

In order to access a filesystem object, its pathname must be specified. A pathname consists of a string (i.e., a sequence of characters) that contains the object's name, and, depending on the type of pathname, its name is preceded by the name of directory in which it resides, the directory in which that directory resides (if any), etc.

Each object in a pathname is separated by a forward slash. Although this character is the same as that used to represent the root directory, the meaning is completely different (i.e., it is merely a separator, not a directory).

A relative pathname contrasts with an absolute pathname in that it tells the location of a filesystem object relative to the current directory (i.e., the directory in which the user is currently working) rather than from the root directory. That is, it is a list of directories between the current directory and a filesystem object.

Thus, for example, the relative pathname of a file in the current directory is just the name of the file by itself. And the relative pathname of a file in a subdirectory of the current directory is the name of the subdirectory followed by a forward slash and then by the name of the file.

An absolute pathname lists all the directories between the root directory and the file or directory of interest, and thus it provides the exact location of the object on the system. An object's absolute pathname is the same regardless of the user's current directory, whereas its relative pathname changes according to what the current directory is.

Every object on a computer or network has a unique absolute pathname. Multiple objects with the same name can exist if each has a unique absolute pathname, that is, if they are located in different directories.

Because an absolute pathname always begins with the root directory, the first character is always a forward slash. A relative pathname does not begin with a forward slash, and thus it is easy to distinguish the two.

If an object is located directly in the root directory, its absolute pathname is formed by prefixing a slash character directly (i.e., with no intervening spaces) to its name. For example, the absolute pathname of the directory named usr, which is a standard directory in the root directory, is /usr.

The directory /usr contains a standard subdirectory named local. The absolute pathname of local is /usr/local. Likewise, a subdirectory of /usr/local named bin would have an absolute pathname /usr/local/bin.

As another example, the absolute pathname /home/sandra/recipes/moussaka refers to a file named moussaka, which is located in a directory recipes, which is a subdirectory of directory sandra, which, in turn, is a subdirectory of directory home, which is located in the root directory.

The absolute pathname of the current directory can be found by using the pwd command, which accepts no arguments (i.e., input data) and is usually used without options, i.e.,


Pathnames on MS-DOS and the Microsoft Windows operating systems use a backward slash instead of a forward slash as a directory separator. Also, there is no single root directory on such systems, but rather a series of quasi-independent root directories with labels such as C:\ and D:\.

It is important to understand the pathname system used on Unix-like operating systems not only because it is used on individual computers but also because virtually the same system is likewise used for Internet addresses.

Created June 11, 2005.
Copyright © 2005 The Linux Information Project. All Rights Reserved.