Linux : Directory /opt vs /usr/local

According to the Filesystem Hierarchy Standard, /opt is for “the installation of add-on application software packages”. /usr/local is “for use by the system administrator when installing software locally”. These use cases seem pretty similar. Software not included with distributions usually is configured by default to install in either /usr/local or /opt with no particular rhyme or reason as to which they chose.

While both designed to contain files not belonging to the Operating System, /opt and /usr/local are not designed to contain the same set of files.

/usr/local is a place to install files built by the administrator usually by using the make command (eg: ./configure; make; make install). The idea is to avoid clashes with files that are part of the operating systems which would either be overwritten or overwrite the local ones otherwise. eg. /usr/bin/foo is part of the OS while /usr/local/bin/foo is a local alternative.

All files under /usr are shareable between OS instances although this is rarely done with Linux. This is a part where the FHS is weak, as /usr is defined to be read-only but /usr/local/bin need to be read write for local installation of software to succeed. The SVR4 file system standard which was the main source of inspiration for the FHS is recommending to avoid /usr/local and use /opt/local instead to avoid this contradiction.

/usr/local is a legacy from the original BSD. At that time, the source code of /usr/bin OS commands were in /usr/src/bin and /usr/src/usr.bin while the source of commands developed locally was in /usr/local/src and their binaries in /usr/local/bin. There was no notion of packaging (outside tarballs).

On the other hand, /opt is a directory where to install unbundled packages, each in its own subdirectory. They are already built whole packages provided by an independent third party software distributor. Unlike /usr/local stuff, these package follow the directory conventions. For example someapp would be installed in /opt/someapp with one of its command being /opt/someapp/bin/foo, its configuration file would be in /etc/opt/someapp/foo.conf, and its log files in /var/opt/someapp/logs/foo.access.


Since 30 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions and medias protecting solutions. I am experienced web-developer with over 10 years developing PHP/MySQL, C#, VB.Net applications ranging from simple web sites to extensive web-based business applications. Besides my work, I like to work freelance only on some wordpress projects because it is relaxing and delightful CMS for me. When not working, I like to dance salsa and swing and to have fun with my little family.

You may also like...