在/etc/profile中添加环境变量后,是使用source /etc/profile编译后只能在当前终端生效

重新开启一个终端后,该环境变量失效。

解决方法:

重启系统:reboot,问题解决

环境变量设置方法:

、/etc/profile:在登录时,操作系统定制用户环境时使用的第一个文件,此 文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行。
、/etc/environment:在登录时操作系统使用的第二个文件,系统在 读取你自己的profile前,设置环境文件的环境变量。
、~/.bash_profile:在登录时用到的第三个文件是.profile文 件,每个用户都可使用该文件输入专用于自己使用的shell信息,当用 户登录时,该 文件仅仅执行一次!默认情况下,他设置一些环境变游戏量,执 行用户的.bashrc文件。/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该 文件被读取.
、~/.bashrc:该文件包含专用于你的bash shell的bash信 息,当登录时以及每次打开新的shell时,该该文件被读取。 几个环境变量的优先级 >> 设置永久环境变量 .环境变量配置中,要先删除.bash_profile中的三行关于.bashrc的 定义,然后把环境变量配置在.bashrc中
.选择要使用的java环境:update-alternatives –config java
.要使得刚修改的环境变量生效:source .bashrc
.查看环境变量:env 可以放到/etc/bash/bashrc,这样就是系统级的

centos7 /etc/profile /etc/bashrc的更多相关文章

  1. 【总结】/etc/rc.d/rc.local 与 /etc/profile .bash_profile .bashrc 文件执行顺序

    登陆shell与交互式非登陆shell的区别 登录shell 所谓登录shell,指的是当用户登录系统时所取的那个 shell.登录shell属于交互式shell. 登录shell将查找4个不同的启动 ...

  2. Linux中profile与bashrc的作用

    文章同步发表在博主网站朗度云,传输门:http://www.wolfbe.com/detail/201608/278.html 在Linux系统上,我们会看到类似于profile和bashrc的文件, ...

  3. profile与bashrc

    /etc/profile./etc/bashrc 是系统全局环境变量设定 ~/.profile,~/.bashrc用户家文件夹下的私有环境变量设定 当登入系统时候获得一个shell进程时.其读取环境设 ...

  4. linux的/etc/profile、~/.profile、~/.bashrc、~./bash_profile这几个配置文件

    在添加环境变量的时候,我们会去修改配置文件 如果留意过,网上博文,有些在/etc/profile文件中配置的,有些是在~./bash_profile文件中配置的,等等 那么,/etc/profile. ...

  5. Linux 启动时profile、bashrc、~/.bash_profile、~/.bashrc、~/.bash_profile执行顺序以及文件说明

    Linux 启动时profile.bashrc.~/.bash_profile.~/.bashrc.~/.bash_profile执行顺序以及文件说明 一.执行顺序 登录linux时,/etc/pro ...

  6. profile和bashrc四种的区别

    Linux下profile和bashrc四种的区别 12160阅读 0评论 /etc/profile./etc/bashrc.~/.bash_profile.~/.bashrc很容易混淆,他们之间有什 ...

  7. Linux环境变量设置/etc/profile、/etc/bashrc、~/.profile、~/.bashrc区别

    登入系统读取步骤: 当登入系统时候获得一个shell进程时,其读取环境设定档有三步 : 1.首先读入的是全局环境变量设定档/etc/profile,然后根据其内容读取额外的设定的文档,如 /etc/p ...

  8. Linux profile1,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part1

    profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 1   by:授客 QQ:103355312 ...

  9. [No0000177]详解/etc/profile、/etc/bash.bahsrc、~/.profile、~/.bashrc的用途

    之前安装Linux的一些软件时,总要修改Linux的配置文件.当时也是一知半解.而且,网上有些安装教程,会说,修改配置文件后要重启Linux.但事实上是不需要重启的. Linux安装时可能要修改的配置 ...

随机推荐

  1. 在启动Windows Process Activation Service时,出现错误13:数据无效

    在启动Windows Process Activation Service时,出现错误13:数据无效 1.错误原因: 当Windows Process Activation Service从C:\Wi ...

  2. python中hashlib md5

    如下两种方法,结果相同 import hashlib import time m = hashlib.md5() m.update(str(time.time()).encode('utf-8')) ...

  3. springMVC学习(12)-使用拦截器

    一.拦截器配置和测试: 1)定义两个拦截器,(要实现HandlerInterceptor接口) HandlerInterceptor1: package com.cy.interceptor; imp ...

  4. Tensorflow笔记——神经网络图像识别(五)手写数字识别

  5. Appium简介和初步使用520-1

    1.移动互联网架构简化图 2.Appium的优势 * 多种开发模式支持 native hybrid webview * 多平台支持 android ios * 跨语言 java python ruby ...

  6. js中级总结

    this问题: this是JavaScript的关键字      用途:指向某一个对象 如何判断this的指向 函数内:两种情况:1.以函数形式调用(不带 . 指向window ) 2.以方法形式调用 ...

  7. 1116 Come on! Let's C (20 分)

    1116 Come on! Let's C (20 分) "Let's C" is a popular and fun programming contest hosted by ...

  8. Win10巧用自带输入法轻松打出特殊字符

    给电脑输入信息时,如果要用上键盘上没有的特殊符号,那就为难了.其实,在Win10中,自带的微软拼音就能让你轻松输入键盘上没有的符号.下面来看看Win10如何输入特殊符号. 微软拼音不但中文输入智能化做 ...

  9. php使用inotify实现队列处理

    php使用inotify实现队列处理参考如下文章:http://blog.jiunile.com/php%E4%BD%BF%E7%94%A8inotify%E5%AE%9E%E7%8E%B0%E9%9 ...

  10. Lua C++互传结构体实例

    转自:http://bbs.csdn.net/topics/350261649 =====main.cpp======= #include "stdio.h" extern &qu ...