Linux Fundamentals - $LD_LIBRARY_PATH variable
by
Jeremy Canfield |
Updated: December 24 2020
| Linux Fundamentals articles
LD_LIBRARY_PATH is an environmental variable that will contain one or more paths that the linker will search for when the linker is searching for a shared file. For example, LD_LIBRARY_PATH may contain something like this. The directories in LD_LIBRARY_PATH will be searched before the /lib and /usr/lib directories are searched.
LD_LIBRARY_PATH=/opt/foo:/usr/bar
LD_LIBRARY_PATH can temporarily be defined on the command line.
~]# LD_LIBRARY_PATH=/opt/foo:/usr/bar
~]# echo $LD_LIBRARY_PATH
/opt/foo:/usr/bar
Better yet, LD_LIBRARY_PATH can be defined in your /home/username/.bash_profile file, so that every time you sign into the system, your PATH will contain the directories defined in your .bash_profile file.
LD_LIBRARY_PATH=/opt/foo:/usr/bar
export LD_LIBRARY_PATH
Did you find this article helpful?
If so, consider buying me a coffee over at