52 Chapter 4 – A Beginner’s Guide to the ServerIntroduction to Unix
Web Design in a Nutshell, eMatter EditionRelative pathnamesA relative pathname points to a file or directory relative to your current working
directory. When building a web site on a single server, relative pathnames are
commonly used within URLs to refer to files in other directories on the server.
Unless you specify an absolute name (starting with a slash) the shell assumes you
are using a relative pathname. Starting in your current location (your working
directory), you can trace your way up and down the directory hierarchy. This is
best explained with an example.
If I am currently working in the directoryjenand I want to refer to the fileart.html,
the relative pathname would bepers/art.htmlbecause the fileart.htmlis in the
directory pers, which is in the current directory, jen. This is illustrated in
Figure 4-4.Figure 4-3: Visual representation of the path /users/jen/persFigure 4-4: Visual representation of the path pers/art.html relative to the jen
directory/ (root)bin etc users tmp libjen richardwork persart.htmlwork/usersjenpers/users/jen/pers/ (root)bin etc users tmp libjen richardwork persart.htmlworkjenperspers/art.htmlart.htmlcurrent directory