Linux environment variable setting method summary PATH, Ld_library_path

Source: Internet
Author: User

Path: The lookup path to the executable program

To view the current environment variables:

Echo $PATH


Set up:

Method One: Export path=path:/xxx but fails after exiting the current terminal


Method Two: Modify the ~/.BASHRC or ~/.bash_profile or system level/etc/profile

1. Add For example export Path=/opt/activepython/bin: $PATH

2. Source. BASHRC (The source command is also known as a "point command", which is a dot symbol (.).)

The source command is typically used to re-execute a newly modified initialization file for immediate effect without having to log off and log back in.



Ld_library_path: Find path for dynamic libraries

Set up:

Method One: Export ld_library_path=ld_library_path:/xxx but fails after exiting the current terminal

Method Two: Modify the ~/.BASHRC or ~/.bash_profile or system level/etc/profile

1. Add For example export ld_library_path=/opt/activep/lib: $LD _library_path

2. Source. BASHRC (The source command is also known as a "point command", which is a dot symbol (.).) The source command is typically used to re-execute a newly modified initialization file for immediate effect without having to log off and log back in.


Method Three: This is not modified Ld_library_path but the effect is the same as the implementation of dynamic library search,

1. Add a line below/etc/ld.so.conf/usr/local/mysql/lib

2. After saving, execute ldconfig effective

(The purpose of the Ldconfig command, mainly in the default search directory (/lib and/usr/lib) and the dynamic library configuration file/etc/ld.so.conf in the directory listed in the search for a shareable dynamic link library (format as described above, lib*.so*), This creates the connection and cache files required by the dynamic loader (ld.so). The cache file defaults to/etc/ld.so.cache, which holds the list of queued dynamic-link library names.


Method Three is slightly cumbersome, and the benefit is that the comparison is not restricted by the user.


Ld.so.conf inside the configuration, the added path is the highest priority path;

[Email protected] ~]# cat/etc/ld.so.conf

Include ld.so.conf.d/*.conf

/usr/local/fan/lib

/usr/local/fan/lib64


This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://mofansheng.blog.51cto.com/8792265/1911009

Linux environment variable setting method summary PATH, Ld_library_path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.