查看环境变量
export
env
echo $PATH
修改环境变量
命令式修改
- 立即生效
- 仅在当前终端窗口有效,窗口关闭后无效
- 仅对当前用户有效
export PATH=${HOME}:$PATH
修改 ~/.bashrc
vim ~/.bashrc
export PATH=${HOME}:$PATH
source ~/.bashrc
修改 ~/.bash_profile
vim ~/.bash_profile
export PATH=$PATH:/home/igs
source ~/.bash_profile
修改 /etc/bashrc
chmod -v u+w /etc/bashrcvim /etc/bashrc
export PATH=$PATH:/home/igssource /etc/bashrc
修改 /etc/profile
chmod -v u+w /etc/profilevim /etc/profile
export PATH=$PATH:/home/igssource /etc/profile
修改 /etc/environment
chmod -v u+w /etc/environmentvim /etc/environment
export PATH=$PATH:/home/igssource /etc/environment