The Filesystem Hierarchy Standard specifies where to put files.
If you're installing files outside of the package manager, always put them under /usr/local
or under /opt
. Never touch anything under /usr
except via the package manager, except for things under /usr/local
.
/usr/local/bin
: executables intended to be executed by users (interactively or from scripts)
/usr/local/lib
: libraries available to many programs, not just yours
/usr/local/lib/YOUR-PROGRAM-NAME
: any other architecture-dependent files
/usr/local/share/doc
: documentation (except in man and info format)
/usr/local/share/info
: documentation in info format
/usr/local/share/man/man*
: man pages
/usr/local/share/YOUR-PROGRAM-NAME
: any other architecture-independent files
These days, the separation of the share
area which contains architecture-independent files isn't very important. It was devised back when hard disks were smaller and it was important to save space by not storing architecture-independent files twice in heterogeneous networks. You can skip this distinction if you like and put everything under lib/YOUR-PROGRAM-NAME
.
If you prefer to use /opt
, put everything under /opt/YOUR-PROGRAM-NAME
, and make symbolic links in /usr/local/bin
(and /usr/local/share/man/man*
and /usr/local/share/info
if you provide documentation in man and info format) so that users can invoke your program.
If you make deb or rpm packages, put files under /usr
instead of /usr/local
. Check each distribution's documentation for its particularities.
/opt
one. The LHS says/opt
should not be used for binary packages that are part of the system.man hier
.