我们在Linux系统上安装一些工具或者环境的时候,有时候为了方便需要把它添加到环境变量方便使用
Linux添加环境变量有好几个方法
一、使用export
命令
运行
export PATH=$PATH:/usr/local/iftop/sbin
此方法,只对本次会话有效,登出或注销系统就会失效
二、修改~/.bash_profile
在 PATH=$PATH:$HOME/bin
之后添加
/usr/local/iftop/sbin
此方法,只对当前用户有效
三、修改/etc/profile
在文件尾部写入
export PATH=/usr/local/iftop/sbin:$PATH
执行命令
source /etc/profile
此方法,对任何用户,永久生效。