What is absolute path?
The absolute path (occasionally known as the full path) of an entity contains all the
Absolute path in file systems
Different operating systems have different syntax for absolute paths.
Windows
The illustration above depicts a directory structure in a Windows environment. Below are the absolute paths to some files and folders in the sample directory:
- Macaroni file:
C:\Recipes\Pasta\Macaroni - Cheese cake file:
C:\Recipes\Cakes\CheeseCake - Work folder:
C:\Work - Audit report file:
C:\Work\AuditReport
Note: Here,
C:\is the root directory.
Linux/Unix
Below is an example of an absolute path to a file stored on a Linux/Unix system:
/home/Educative/Courses/Python.txt
Note: Here,
/refers to the root directory.
Mac OS
Finally, let’s look at an example of an absolute path to a file stored on a Mac OS system:
/Users/Sarah/Desktop/Educative/Courses/Java.txt
Note: Here,
/refers to the root directory.
Absolute path in websites
Websites also have absolute paths. URLs hold the information to a website’s path and are usually visible on your browser’s search bar. Let’s use Educative’s website as an example. Below are the absolute paths to land on different webpages of Educative’s website:
- Homepage:
https://www.educative.io - Edpresso page:
https://how.dev/answers/ - Explore page:
https://www.educative.io/explore
Finally, let’s look at the absolute path to this very shot:
https://how.dev/answers/absolute-path
Free Resources