short: no
long: The related environment variables are system- and configuration-dependent. For a given system/configuration, you could write a script which does this.
Where do executables look for shared objects at runtime gives some insight, but is incomplete. It mentions OSX and Solaris, but focuses on Linux, pointing to two resources:
You would also find these useful:
- ldconfig - configure dynamic linker run-time bindings, Linux-specific (neither OSX or Solaris):
ldconfig
creates the necessary links and cache to the most recent
shared libraries found in the directories specified on the command
line, in the file /etc/ld.so.conf
, and in the trusted directories,
/lib
and /usr/lib
(on some 64-bit architectures such as x86-64, lib
and /usr/lib
are the trusted directories for 32-bit libraries, while
/lib64
and /usr/lib64
are used for 64-bit libraries).
- How do shared libraries work in a mixed 64bit/32bit system?
- shlib script, a utility script in ncurses listing a variety of environment variables used for specifying where shared libraries are.
In particular, "sudo ldconfig -v
"
-v
, --verbose
Verbose mode. Print current version number, the name of each
directory as it is scanned, and any links that are created.
Overrides quiet mode.
which is close to what was asked, but gives lots of extraneous information. (And it is largely Linux-specific, though BSDs use it — but different, see manual page). If you make some assumptions about its output format, you could get directories from this using
sudo ldconfig -v 2>/dev/null | grep ':$' |sed -e 's/://'
which gives (on one system)
/usr/local/lib
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/lib
/usr/lib
To recap: there is no command, but you can make a script, which is system-dependent.
$dir/x86_64
,$dir/tls
and$dir/tls/x86_64
– do you know how is this behavior configured? – Piotr Dobrogost Mar 18 '19 at 14:26