Frequently Asked Question
What is the difference between an absolute path and a relative path?
An absolute path starts with a forward slash and gives the full route from the
root of the filesystem down to the file: /home/chris/projects/tblinux/chapter.md
always refers to the same file no matter where you are when you type it. A relative
path does not start with a slash and is interpreted with respect to your current
working directory. If you are sitting in /home/chris/projects, then
tblinux/chapter.md and the absolute form name the same file; if you cd somewhere
else, the relative form now means something different.
Use absolute paths in scripts, configuration files, and anywhere the working directory
cannot be assumed. Use relative paths at the shell prompt where they are shorter and
more convenient. pwd shows you where you are now, and a few shortcuts smooth things
over: . is the current directory, .. is the parent, ~ is your home directory,
and cd - jumps back to the previous directory.