108 words
1 minutes
Absolute and Relative Paths in Linux
Absolute Paths
An absolute path is a full path from the root directory (denoted by /
). It specifies the exact location of a file or directory within the filesystem, regardless of the current working directory.
- Root Directory: /
- Example: /home/user/Documents/report.txt
Absolute paths always begin with a /
.
Relative Paths
A relative path is a path that starts from the current working directory. It specifies the location of a file or directory relative to where you are currently located in the filesystem.
- Current Directory: .
- Parent Directory: ..
- Example: If your current directory is
/home/user
, and you want to accessreport.txt
in theDocuments
folder, the relative path would beDocuments/report.txt
.
Relative paths do not begin with a /
.
Absolute and Relative Paths in Linux
https://rabisiddique.com/posts/absolute-vs-relative-paths/Author
Rabi Siddique
Published at
2024-07-18