The /opt/ directory in Linux is used for installing add on packages.

What is the difference between the /opt/<package>/bin directory and the /opt/<package>/X/bin directory? What is the difference between placing the binary in these directories?

Could you also please point me to some documentation which explains what the directory structure should be for a new software package/application installed in the /opt/ directory?

  • 1
    Wait, was @Stephen Kitt's edit what you actually meant? You seemed previously to be asking about /opt/bin (which I've seen) vs. /opt/package/bin, but now it looks like you're asking about /opt/package/X/bin, which I haven't seen in any package...
    – Bandrami
    Commented Apr 23, 2015 at 5:23
  • @Bandrami, my edit just revealed what @arun had typed originally; the <package> portions of the paths were interpreted as HTML tags. So the original input, /opt/<package>/bin, appeared as /opt//bin, and /opt/<package>/X/bin appeared as /opt//X/bin. Commented Apr 23, 2015 at 5:25

1 Answer 1


Per FHS, /opt/bin, /opt/lib, /opt/info, /opt/include, /opt/doc, and /opt/man are there for the administrator's convenience. For instance, you might have /opt/jdk and /opt/LibreOffice holding your jdk and office suite, but rather than add a new element to $PATH, ld.so.conf, etc. every time you add another package, you can just symlink the binaries to /opt/bin, the libs to /opt/lib, etc.

Basically, you should put the binary in /opt/foo/bin and, at your discretion, symlink the binary into /opt/bin

FHS does not specify any particular organization within /opt/package, but the widely accepted practice is to make a bin and lib directory, and possibly doc, man, etc. as needed.

As a side note: if you are writing to /opt/foo FHS also clears you to write to /etc/opt/foo and /var/opt/foo.

You must log in to answer this question.

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