There are three ways to set environment variables:
1. Temporary
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:new_path_name
where new_path_name is the new path. This is only valid for the current shell. It disappears after restarting.
2. Permanent
vim /etc/profile export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:new_path_name source /etc/profile
Global environment variables will not disappear after restarting and are valid for all users.
3. Permanent
~/.bashrc export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:new_path_name source .bashrc
Global environment variables will not disappear after restarting, but are only valid for the currently logged in user.
Recommended tutorial: linux tutorial
The above is the detailed content of How to set environment variables in linux. For more information, please follow other related articles on the PHP Chinese website!