码迷,mamicode.com
首页 > 其他好文 > 详细

环境变量

时间:2018-07-07 22:35:23      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:存在   whereis   profile   https   $path   div   保存   hid   二进制文件   

1、系统环境变量

执行 vi /etc/profile

 范例(设置maven环境变量):

 export M2_HOME=~/apache-maven-3.5.2

 export PATH=$PATH:$M2_HOME/bin

保存后执行source /etc/profile立即生效

2、用户环境变量

cd /home/用户名 ,进到普通用户的家目录下,可以看到用户的环境变量文件.bash_profile

vi .bash_profile

保存后执行 source .bash_profile立即生效

3、查看当前有哪些环境变量

直接输入命令:env

4、查看系统环境变量

echo $PATH

5、which命令是查找命令是否存在

which npm

6、whereis命令只能用于搜索程序名,而且只搜索二进制文件(参数-b)、man说明文件(参数-m)和源代码文件(参数-s)。如果省略参数,则返回所有信息

whereis npm

环境变量

标签:存在   whereis   profile   https   $path   div   保存   hid   二进制文件   

原文地址:https://www.cnblogs.com/yangwenzhi/p/9278347.html

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