码迷,mamicode.com
首页 > 系统相关 > 详细

linux下查看和添加path环境变量

时间:2016-06-24 12:29:52      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:

单独查看PATH环境变量,可用: 

 

[root@localhost u-boot-sh4]#echo $PATH 

/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin 

 

添加PATH环境变量: 

第一种方法:

[root@localhost u-boot-sh4]#export PATH=/opt/STM/STLinux-2.3/devkit/sh4/bin:$PATH 

 

再次查看: 

 

[root@localhost u-boot-sh4]# echo $PATH 

/opt/STM/STLinux-2.3/devkit/sh4/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

 

说明添加PATH成功。 

 

上述方法的PATH 在终端关闭 后就会消失。所以还是建议通过编辑~/.bashrc或~/.bash_profile或系统级别的/etc/profil来改PATH,也可以改家目录下的.bashrc(即:~/.bashrc)。 

 

第二种方法: 

# vim /etc/profile 

在文档最后,添加: 

export PATH="/opt/STM/STLinux-2.3/devkit/sh4/bin:$PATH" 

保存,退出,然后运行: 

#source /etc/profile 

不报错则成功。 

 

linux下查看和添加path环境变量

标签:

原文地址:http://www.cnblogs.com/chen-lhx/p/5613359.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!