## It's all relative

If you're on your way to work but you stop by a deli for breakfast first, you don't go back home after breakfast so you can restart your journey.
Instead, you continue from where you are, because you understand where your office is located relative to your current location.
Navigating your computer is the same way.
If you change your working directory in a terminal to a subdirectory, such as ``Pictures``, you don't necessarily have to go home again just to make your way into ``Documents`` using a **relative** path.

Conversely, absolute paths always start from the start of your hard drive.
You know that you've reached the start of your drive by a forward slash (``/``) with nothing to the left of it, because the root level of your drive is the biggest container that holds all your folders and files within it.
For that reason, the path ``/home/seth`` (and its shorthand version ``~/home``, although that's less clear because it lacks the leftmost slash) is considered an absolute path: it represents the base level of your hard drive, which contains the ``home`` directory, which in turn contains ``seth`` (my username).
Anything starting with a lone forward slash is an absolute path, and it is the digital equivalent of you going 12 blocks back home just to find your way to a location that's 2 blocks away from where you rare now.
That doesn't mean it's bad; there are many valid reasons to use absolute paths, not the least of which is their clarity.
If you can navigate your drive from absolute paths, then use that as a wayfinder.
With autocompletion, typing a full path can be as quick as using a relative path.

That said, relative paths can be convenient, and in some cases vital.
For instance, you can never actually be sure of the absolute path on a web server.
If a web designer knows they have [web fonts in a local directory](https://opensource.com/article/19/3/webfonts), and they link to those fonts on their development laptop using the absolute path ``/home/webdev/Public/www.example.com/fonts``, then all of their links break when the code is pushed to ``/var/www/example.com/fonts`` on the server.
Besides that, sometimes it really *is* quicker and easier to type ``cd ../Documents`` instead of ``cd /home/seth/Documents``.

Relative paths use two control sequences: the single (``.``) and the double (``..``) dot.

A single dot means *don't move*.

The double dot means *take one step back*.

This works best when you're somewhat familiar with what's on your drive, and provided that you can visualize the corresponding paths.
It may help to visualize each directory as a room in a house.
For instance, knowing that you have a home directory that contains both a ``Pictures`` and a ``Documents`` folder, you can visualize each subdirectory as a step forward from home:

![Stepping into a directory](path-layout.jpg)

To get from one room to the other, you must go back to the common area using the *step back* control sequence, and then step forward into the other.
You can get your current location at any time with the ``pwd`` (print working directory) command:

```
$ pwd
/home/seth/Pictures
$ cd ../Documents
$ pwd
/home/seth/Documents
```

A single dot means *don't move*, and it does exactly that:

```
$ pwd
/home/seth
$ cd .
$ pwd
/home/seth
```

It might seem odd to have a special command representing a state of no change, but it's a usefully explicit directive.
For instance, were you to create a custom application to [list a directory's contents](LINK TO ls ARTICLE) and saved it in your home directory, foolishly naming it ``reboot``, then any time you used that custom application you would want to be very careful that your computer knew exactly which ``reboot`` command you mean to execute.
One way you could do that is to provide an explicit path to your custom, and poorly named, application.
The single dot reinforces your desire not to stray from your intended path:

```
$ pwd
/home/seth
$ ./reboot
Documents/     Downloads/
Music/         Pictures/
Public/        Videos/
Spheniscidae/  Yugolothae/
```

Sometimes the single dot can also be useful as a filler character in paths that expect to contain some number of levels. For instance, if a web developer has used several links to a font directory that was once 3 steps back, but the font directory has recently been moved into the same directory as their HTML, then replacing all instances of ``../../../fonts`` with ``./././fonts`` maintains a functioning site (in this example, so does changing it to just ``./fonts``, but assume that doing so would break a script that expects to see 3 levels before the ``fonts`` directory).

Relative paths can be confusing at first, so stick to absolute paths when navigating your computer until you're comfortable with the concept of relativity.
Many people find them useful, while others do not use them.
It's all relative.