🐧 Linux / Shell Scripting
Beginner
What is the difference between absolute and relative paths?
Answer
An absolute path starts from the root directory / and fully specifies the location of a file regardless of the current directory, e.g., /home/user/docs/report.txt. A relative path is specified relative to the current working directory, e.g., docs/report.txt or ../sibling/file. Absolute paths are unambiguous and safe to use in scripts. Relative paths are shorter and useful for portable references within a project. The special tokens . (current dir) and .. (parent dir) are used only in relative paths.