Home > Operation and Maintenance > Linux Operation and Maintenance > How to set environment variables in linux

How to set environment variables in linux

王林
Release: 2020-05-15 13:58:49
Original
4336 people have browsed it

How to set environment variables in linux

There are three ways to set environment variables:

1. Temporary

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:new_path_name
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template