I am trying to figure out what are the benefits of using relative path names over absolute path names. I know what each one is.

I guess that it is easy to work with relative path names when we have long path to the current location. For example - The command mkdir:

mkdir backup/old ----> : relative path ---->Better

mkdir /home/me/backup/old ----> : absolute path

But I am trying to find another advantage (just one) for relative path names and I can`t find.

Would you please explain more about this issue?

closed as primarily opinion-based by Thomas Dickey, Isaac, RalfFriedl, DarkHeart, Romeo Ninov Sep 16 '18 at 3:18

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Relative paths usually accommodate staging of distro packages. Also see DESTDIR in the GNU Coding Standards. – user56041 Sep 15 '18 at 14:54
  1. Quicker and easier to type, so less chance of a mistake
  2. Portable (location independent) when creating symbolic links
  • Can you explain the second advantage, please? – Haim Sep 15 '18 at 14:45

Advantage of relative path names over absolute path names

A big advantage of relative paths is accommodate staging of distro packages when using a standard filesystem layout. For example, if a binary in /usr/bin/ needs data in /usr/share/, then a DATADIR of ../share/ means the binary can be installed anywhere and the binary can locate its data.

The situation often arises in staged installs using DESTDIR. Instead of installing into /usr/bin or /usr/local/bin using BINDIR alone, the package can be located in /opt/usr/ which equates to $(DESTDIR)$(PREFIX) with DESTDIR=/opt/ and PREFIX=/usr. The binary is located at BINDIR=/opt/usr/bin and the data is located at DATADIR=/opt/usr/bin/../share.

Also see DESTDIR in the GNU Coding Standards.

  • Do you please have a simple example? I am not an expert at Linux....... – Haim Sep 15 '18 at 15:20

Take configure script of any open source software.

E.g. if you have git repo new_editor with 2 submodules and you're writing an installation script for it, you can't write:


You should write

  • I can`t see the difference from my example --> its still making life easier. That is already understood. I need something else, please! – Haim Sep 15 '18 at 15:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.