How else can I identify files and directories?
An absolute path is like a latitude and longitude: it has the same value no matter where you are. A relative path, on the other hand, specifies a location starting from where you are: it's like saying "20 kilometers north".
As examples:
- If you are in the directory
/home/repl
, the relative pathseasonal
specifies the same directory as the absolute path/home/repl/seasonal
. - If you are in the directory
/home/repl/seasonal
, the relative pathwinter.csv
specifies the same file as the absolute path/home/repl/seasonal/winter.csv
.
The shell decides if a path is absolute or relative by looking at its first character: If it begins with /
, it is absolute. If it does not begin with /
, it is relative.
This exercise is part of the course
Introduction to Shell
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
