Paths of a file in your OS

In computing, a path is the way to reference a computer file or directory in a file system of a given operating system. A path pinpoint the exact location of a file or directory using a particular string of characters. This can be in various forms depending on the operating system and file system in question. Overall it is composed of the names of the directories that make up the path to the file or directory along the directory tree, and will ultimately be the name of the file or directory you want to reference. These names will be separated by a delimiter character is usually the backslash (\) in MS-DOS and Windows (from Microsoft) operating systems or slash (/) on UNIX or Linux systems.

Ways to express a route

In most operating systems and file systems, a route can be expressed in relatively or absolutely.

Absolute path

Absolute paths point to the location of a file or directory from the root directory of the file system.

/home/dir1/arc1.fil


Relative path


Relative paths point to the location of a file or directory from the current position of the operating system on the file system.For example, it is a relative:

dir1/arc1.fil

path pointing to arc1.fil file within the directory dir1 in the present location. On Unix systems, route ~ / is a relative path that leads to the user who inserted the relative path directory; for example, if the user John Doe has a picture in his home directory, this image could have two paths, relative and absolute:

  • Absolute: /home/johndoe/image.jpg
  • Relative: ~/image.jpg

In this case, the relative path can only be truly valid if the system is located in the user John Doe. In this case, ~/ would be the relative synonymous with the path /home/fulano/.