1

With Ubuntu 14.04 LTS. I am working on a custom install of gcc that I want to put alongside the supported version that is too old for my purposes.

My computer has version 4.8.4 installed from the Ubuntu repository, and I was looking at whereis gcc to see how the gcc files are arranged in the filesystem normally.

I then noticed that the same executables are stored both in /usr/bin/ and /usr/bin/X11 (using ll -L on both folders). The following questions arise:

  • In general, what is the purpose of /usr/bin/X11/ as distinct from /usr/bin/? I have looked into the standard filesystem hierarchy, and /usr/bin/X11/ is no standard directory;
  • In particular, is it correct to assume that the files in /usr/bin/X11/ are just a copycat of those in /usr/bin/ as a matter of rule? The new gcc has no <mount point>/bin/X11 folder in its tree. This is useful to know in order to redirect with confidence the existing symlinks in /usr/bin/X11 to the executables of the new version (no-devil-in-the-details point of caution).

Thanks for thinking along.

9
  • What does dpkg -S /bin/X11 report?
    – muru
    Feb 11, 2017 at 10:27
  • So no package created that. You should ask your system administrator
    – muru
    Feb 11, 2017 at 10:50
  • 2
    See askubuntu.com/q/191654/158442 and /usr/share/doc/x11-common/NEWS.Debian.vz
    – muru
    Feb 11, 2017 at 11:10
  • 1
    Once upon a time there was no GUI. And when the X Window System appeared, it came with wondrous graphical programs such as xterm and xclock and so on. And people used to put those graphical programs in a special directory, which in time became /usr/bin/X11. But nowadays all binaries live in /bin and /usr/bin and /sbin and /usr/sbin; while /usr/bin/X11 serves no purpose any longer, it is still created as a symlink to /usr/bin in order to keep compatibility with old sysadmins and old scripts, which are used to xterm being /usr/bin/X11/xterm.
    – AlexP
    Feb 11, 2017 at 11:15
  • 1
    @XavierStuvw: /usr/bin/X11 is a file in /usr/bin. It is a symlink pointing to the current directory, .; this makes /usr/bin/X11 a synonym for /usr/bin.
    – AlexP
    Feb 11, 2017 at 11:57

2 Answers 2

3

Once upon a time there was no GUI. And when the X Window System appeared, it came with wondrous graphical programs such as xterm and xclock and so on, and with utilities such as xrdb and xmodmap. And people used to put those graphical programs in a special directory, which in time became /usr/bin/X11. (X11 because the the final version of the X Protocol is 11, specifically X version 11 release 6 point 4, X11R6.4; before X11 there were and X9 and an X10.)

But nowadays all executables live in /bin and /usr/bin and /sbin and /usr/sbin; while /usr/bin/X11 serves no purpose any longer, it is still created as a symbolic link to /usr/bin in order to keep compatibility with old sysadmins and old scripts, which are used to xterm being /usr/bin/X11/xterm.

So the answer is that it is not the executables which are the same in /usr/bin and /usr/bin/X11: it is /usr/bin/X11 itself which is the same as /usr/bin.

If you look you will notice that /usr/bin/X11 is a symlink to .. This is called a relative symlink: /usr/bin/X11 being a file in /usr/bin and a symlink pointing to the current directory, ., this makes /usr/bin/X11 a synonym for /usr/bin.

1

In order to discover what the path and file actually point to, do

$ realpath /usr/bin/X11
/usr/bin

Fun variant:

$ myDir=/usr/bin/X11
$ echo $(realpath -s $myDir) is in fact $(realpath $myDir)
/usr/bin/X11 is in fact /usr/bin

This is the on-line man page of realpath.

Thanks @AlexP and @muru for putting me on the right track

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .