I have a "library" file (containing general functions) I source in many different bash scripts. What's the correct filesystem location to system-wide "install" this file in?

/usr/lib/myBashlib/file.bash ?

I don't want to place it below /opt, but properly install it by making a package for my distro.

EDIT: My distro specifies, that "Packages should never be installed to /usr/local/" (EDIT2:) and also "Avoid using /usr/libexec/ for anything".

EDIT3: I wonder, if the best way would be, to just define an environment variable (e.g. MYBASHLIBPATH) ... This would at least allow users of scripts that include this lib to install it locally instead of globally and then just set this variable to the path they installed it in ...


2 Answers 2


FHS does not specify the location for "library" files sourced by bash scripts but the the desired locations could be /usr/libexec/packagename or /usr/lib/packagename/.

Locations with e.g. Bash scripts I've found on Fedora 36:



And many others.

  • I just want to say I'm sorry: I didn't realize that you made location into a link.
    – anick
    Commented Jul 21, 2022 at 17:32
  • Finally. It's OK. Have a good day :-) Commented Jul 21, 2022 at 17:32
  • Have a good day, too :)
    – anick
    Commented Jul 21, 2022 at 17:33

I do not think there is standard place for "library" scripts. But you may find /usr/local tree convenient, for example /usr/local/scripts.

You must log in to answer this question.

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