Some time ago, a Linux-guy asked me what the libexec and libdata directories present on a BSD system (placed under /, /usr, or other top-level hierarchies) are, because he had never seen them before in his Linux box. So here is a detailed explanation.

libexec is a directory that contains daemons and utilities that can't be used directly by the user. Simply put, they rely on other programs to launch them. For example:

  • The dynamic linker (/libexec/ld.elf_so in NetBSD) is placed in this directory because it is executed by the kernel whenever a new program is started. The user can't launch this program directly.
  • Simple daemons launched by inetd(8) are here because they can't be launched as standalone daemons. Consider telnetd(8), identd(8), etc.
  • Several parts of GCC (such as cc1, cc1obj, cc1plus, etc.) are here because there is no direct use for them.
  • All GNOME Panel applets are here because they rely on the Panel to launch them (so that they can be attached to the right bar).
  • Component providers, such as evolution-data-server, are also here because other applications have to launch them through Bonobo (or whatever).
  • And a large etcetera...

On the other hand, libdata holds static data files, which are used by other programs or libraries. This data is usually in binary format, not shareable across computers and/or not intended for direct use. Otherwise, it could simply go into share. For example, in pkgsrc, we use this directory to store static databases, such as the one used by ScrollKeeper to index documentation, or the one used by GStreamer to keep track of registered plugins.

But where does Linux store these files, if it does not use these hierarchies? It depends on the distribution. The most typical place is somewhere under the lib tree, in a subdirectory named after the package name. (It may be that some distributions use these directories, though.)

Ah! Before saying that BSDs use strange trees... keep in mind that, by default, all scripts created by GNU Autoconf default to these directories!

Go to posts index

Comments from the original Blogger-hosted post: