Can programs installed under /opt be safely symlinked into /usr/local/bin, which is already in the PATH by default in Ubuntu and other Linux distros?

Alternatively, is there some reason to create a separate /opt/bin and add that to the PATH, as in this answer: Difference between /opt/bin and /opt/X/bin directories?

1 Answer 1


There is a difference between /opt and /usr/local/bin. So just symlinking binaries from one to another would be confusing. I would not mix them up.

/opt is for the installation of add-on application software packages, whereas the /usr/local directory is for the system administrator when installing software locally (with make and make install). /usr/local/bin is intended for binaries from software installed under /usr/local.

According to the File Hierarchy Standard, the correct way would be to add /opt/<package>/bin to the $PATH for each individual package. If this is too painful (when you have an uncountable number of /opt/<package>/bin direcories for example) then you (the local administrator) can create symlinks from /opt/<package>/bin to the /opt/bin directory. This can then be added to the users $PATH once.

  • Eh, why? /usr/local/bin is for the system administrator's use. If the admin wants to install software in /opt and create links for it under /usr/local, that's perfectly cromulent. Dec 8, 2015 at 22:55
  • @Gilles Of course he can, he can do whatever he wants, he's the system administrator. But best practice would be to keep them separate.
    – chaos
    Dec 9, 2015 at 6:40
  • Okay, so it sounds like this is more an issue of standard convention than anything else. I was a bit weirded out by the lack of symmetry "There is a difference between /opt and /usr/local/bin" as opposed to than "...between /opt and /usr/local" or "...between /opt/bin and /usr/local/bin", but after getting to the end I suspect it was meant as a way to combine /opt/bin and /opt/.../bin. If so, I wonder if the wording could be improved. Dec 11, 2015 at 1:27
  • 1
    @chaos You write that, according to FHS, /opt/package/bin/ or at least /opt/bin/ should be added to $PATH. I read through the posted reference and it does say a lot about how to structure /optand what to have inside there but I could not find a confirmation that any of those directories under /opt should be added to $PATH. Could you maybe elaborate how you came to that conclusion? Cheers
    – vic
    May 3, 2016 at 11:54
  • @vic The same reason you would put any other /whatever/bin directory to $PATH -- so you can invoke the executables without typing the full path every time. Oct 5, 2017 at 13:46

You must log in to answer this question.

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