Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
来源:互联网 发布:海陆丰制毒 知乎 编辑:程序博客网 时间:2024/05/17 04:00
在安装nsq的时候遇到环境变量的配置问题,参考的博客中既有修改/etc/profile的,也有修改~/.bashrc的……
为了搞清楚为什么修改这个,转载了一篇总结得稍好些的博客记录。地址:http://blog.csdn.net/qiao1245/article/details/44650929
最近配置了JAVA和Scala的环境变量,发现自己对Linux下 /etc/profile、/etc/bashrc、~/.bashrc的区别不是特别清楚,特此查阅了相关资料,整理下来,供以后查阅。如有错误之处,还望各位朋友批评指正。
①/etc/profile:
该文件登录操作系统时,为每个用户设置环境信息,当用户第一次登录时,该文件被执行。也就是说这个文件对每个shell都有效,用于获取系统的环境信息。
# /etc/profile# System wide environment and startup programs, for login setup# Functions and aliases go in /etc/bashrc# It's NOT a good idea to change this file unless you know what you# are doing. It's much better to create a custom.sh shell script in# /etc/profile.d/ to make custom changes to your environment, as this# will prevent the need for merging in future updates.②/etc/bashrc:
为每一个运行bash shell的用户执行此文件,当bash shell被打开时,该文件被读取。也就是说,当用户shell执行了bash时,运行这个文件。
# /etc/bashrc# System wide functions and aliases# Environment stuff goes in /etc/profile# It's NOT a good idea to change this file unless you know what you# are doing. It's much better to create a custom.sh shell script in# /etc/profile.d/ to make custom changes to your environment, as this# will prevent the need for merging in future updates.
③~/.bashrc
该文件存储的是专属于个人bash shell的信息,当登录时以及每次打开一个新的shell时,执行这个文件。在这个文件里可以自定义用户专属的个人信息。
那么在用户登录系统时候,相关的文件执行顺序是什么呢。
在刚登录Linux时,首先启动 /etc/profile 文件,然后再启动用户目录下的 ~/.bash_profile、 ~/.bash_login或 ~/.profile文件中的其中一个,执行的顺序为:~/.bash_profile、 ~/.bash_login、 ~/.profile。如果 ~/.bash_profile文件存在的话,一般还会执行 ~/.bashrc文件。
阅读全文
0 0
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- linux 环境变量 /etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc的区别
- Linux环境变量设置/etc/profile、/etc/bashrc、~/.profile、~/.bashrc区别
- LInux中 ~/.profile ~/.bashrc /etc/profile /etc/bashrc 的区别
- 浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- linux 下/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件的区别
- Linux下.bashrc文件和/etc/profile文件的区别
- /etc/profile 和 /etc/bashrc的区别
- /etc/profile 与 /etc/bashrc 的区别
- /etc/profile ~/.bashrc区别
- /etc/profile /etc/bashrc ~/.bash_profile ~/.bashrc 区别
- iPhone is busy: Preparing debugger support for iPhone
- Java基础知识之——反射
- tensorflow笔记 :常用函数说明
- truncate 与 delete 使用上的区别
- Direct3D中的光照
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- 241. Different Ways to Add Parentheses
- 【我的Java笔记】第二课
- .NET开发常用工具大汇总
- 不同版本(2.3-3.1)web.xml文件的schema头部声明
- 专访阿里云闵万里:云上逐鹿_ET大脑要做行业化、垂直化的创新运用
- HDU 6209 数学
- [Linux] MySQL 单点安装
- 1063. 计算谱半径(20)