Absolute Pathnames
An absolute pathname begins with a slash (/). The Absolute path defines the location of a Directory or a file from the root file system (/). The absolute path contains the full path to the directory or file.
Examples of Absolute Path
/usr/share/doc (Absolute path for a Directory) /usr/share/doc/bash/README (Absolute path for a Directory)
Question: List the directory which contains all docs by using Absolute path.
Answer:
# ls /usr/share/doc/
Relative Pathnames
The relative pathname does not begin with /. It specifies the location relative to your current working directory. Below are some examples of relative pathnames, relative to particular directories.
Current Directory | Relative Pathname |
---|---|
/usr/shar/doc/HTML/ | index.html |
/ | usr/share/doc/HTML/index.html |
/usr | share/doc/HTML/index.html |
You can Face one question in your Technical Interview on this topic..i.e What is the difference between absolute & relative pathnames in Linux?