Linux中profile、bashrc、bash_profile之间的区别和联系
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集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/profile有修改的话必须得重启你的修改才会生效,此修改对每个用户都生效。
/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.
英文描述为:
# /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.
如果你想对所有的使用bash的用户修改某个配置并在以后打开的bash都生效的话可以修改这个文件,修改这个文件不用重启,重新打开一个bash即可生效。
~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件.
此文件类似于/etc/profile,也是需要需要重启才会生效,/etc/profile对所有用户生效,~/.bash_profile只对当前用户生效。
~/.bashrc:该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该文件被读取.(每个用户都有一个.bashrc文件,在用户目录下)
此文件类似于/etc/bashrc,不需要重启生效,重新打开一个bash即可生效, /etc/bashrc对所有用户新打开的bash都生效,但~/.bashrc只对当前用户新打开的bash生效。
~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件.
另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是"父子"关系.
~/.bash_profile 是交互式、login 方式进入bash 运行的;
~/.bashrc 是交互式 non-login 方式进入bash 运行的;
通常二者设置大致相同,所以通常前者会调用后者。
Linux中profile、bashrc、bash_profile之间的区别和联系的更多相关文章
- profile bashrc bash_profile之间的区别和联系
profile bashrc bash_profile之间的区别和联系 博客分类: Linux 执行顺序为:/etc/profile -> (~/.bash_profile | ~/.bas ...
- profile bashrc bash_profile 之间的区别和联系
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置. /etc/bashrc:为每一个 ...
- linux profile\bashrc\bash_profile之间的区别和联系
/etc/profile 每个用户,首次登录时被执行: /etc/bashrc 每个运行bash shell的用户都执行此文件,当bsh被打开时,该文件被读取: ~/.bash_profile 专用于 ...
- linux /etc/profile bashrc bash_profile
文件: /etc/profile ~/.bashrc 和 ~/.bash_profile 的使用区别: /etc/profile: 全局 环境变量等,在机器重启后执行一次, 用于设置环境变量,更 ...
- Linux中yum和apt-get用法及区别
Linux中yum和apt-get用法及区别 一般来说著名的linux系统基本上分两大类: 1.RedHat系列:Redhat.Centos.Fedora等 2.Debian系列:Debi ...
- profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 2
profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 2 by:授客 QQ:103355312 ...
- JavaScript中this和$(this)之间的区别以及extend的使用
jQuery中this和$(this)之间的区别: this返回的是当前对象的html对象,而$(this)返回的是当前对象的jQuery对象 举个正确的Demo实例: $("#textbo ...
- linux中fork, source和exec的区别
转:linux中fork, source和exec的区别 shell的命令可以分为内部命令和外部命令. 内部命令是由特殊的文件格式.def实现的,如cd,ls等.而外部命令是通过系统调用或独立程序实现 ...
- [转] C#中out和ref之间的区别
gskcc 的原文地址 C#中out和ref之间的区别 首先:两者都是按地址传递的,使用后都将改变原来参数的数值. 其次:ref可以把参数的数值传递进函数,但是out是要把参数清空,就是说你无法把一个 ...
- Linux中profile与bashrc的作用
文章同步发表在博主网站朗度云,传输门:http://www.wolfbe.com/detail/201608/278.html 在Linux系统上,我们会看到类似于profile和bashrc的文件, ...
随机推荐
- Request 、Response 与Server的使用
纯属记录总结,以下图片都是来自 ASP.NET笔记之 Request .Response 与Server的使用 Request Response Server 关于Server.MapPath 方法看 ...
- 总结-jQuery
一.ajax提交,如果某个变量的值填的是doc对象,jQuery不报错,也没有反应,如: {userName : $('#userName')}.正确的写法 {userName : $('#userN ...
- Thinking in Java——笔记(11)
Holding Your Objects In general, your programs will always be creating new objects based on some cri ...
- PCB板的质量可接受性标准 IPC-A-600H 中文版下载
对于电子行业的小伙伴来说,经常要找PCB板厂打板,总难免遇到跟板厂因PCB上的质量缺陷扯皮的时候,这是就要有一份公认PCB质量可接受性标准作为最终PCB产品的验收标准,即IPC-A-600标准规范. ...
- iOS - + initialize 与 +load
一.+ initialize 方法和+load 调用时机 首先说一下 + initialize 方法:苹果官方对这个方法有这样的一段描述:这个方法会在 第一次初始化这个类之前 被调用,我们用它来初始化 ...
- RelativeLayout中实现控件平分屏幕
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_con ...
- 真TM操蛋——观《鬼子来了》有感
杀日本人有罪?日本人杀中国人为何无罪?战俘?双手沾满鲜血,仇人,为何杀仇人还要被自己人判刑,被仇人斩首? 看了最后结局,我心里只有这两句话,同学说结局不好,我觉得结局恰恰很好,姜文是个很好的导演,他布 ...
- LeetCode Logger Rate Limiter
原题链接在这里:https://leetcode.com/problems/logger-rate-limiter/ 题目: Design a logger system that receive s ...
- 通过代码自定义cell(cell的高度不一致)
- error in config file "/etc/rabbitmq/rabbitmq.config"
记录一次RabbitMQ配置文件配置错误 error信息: dill@ubuntu-vm:/usr/share/doc/rabbitmq-server$ sudo /usr/lib/rabbitmq/ ...