/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文件,在用户目录下)

~/.bashrc文件类似于/etc/bashrc,不需要重启生效,重新打开一个bash即可生效,/etc/bashrc对所有用户新打开的bash都生效,但~/.bashrc只对当前用户新打开的bash生效

~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件。

~/.bash_profile是交互式、login方式进入bash运行的;

~/.bashrc是交互式、non-login方式进入bash运行的;

通常前者会调用后者

【转】Linux中profile、bashrc、bash_profile之间的区别和联系的更多相关文章

  1. profile bashrc bash_profile之间的区别和联系

    profile bashrc bash_profile之间的区别和联系 博客分类: Linux   执行顺序为:/etc/profile -> (~/.bash_profile | ~/.bas ...

  2. profile bashrc bash_profile 之间的区别和联系

    /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置. /etc/bashrc:为每一个 ...

  3. linux profile\bashrc\bash_profile之间的区别和联系

    /etc/profile 每个用户,首次登录时被执行: /etc/bashrc 每个运行bash shell的用户都执行此文件,当bsh被打开时,该文件被读取: ~/.bash_profile 专用于 ...

  4. linux /etc/profile bashrc bash_profile

    文件: /etc/profile  ~/.bashrc  和  ~/.bash_profile 的使用区别: /etc/profile: 全局 环境变量等,在机器重启后执行一次, 用于设置环境变量,更 ...

  5. 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 ...

  6. Linux中yum和apt-get用法及区别

    Linux中yum和apt-get用法及区别   一般来说著名的linux系统基本上分两大类:   1.RedHat系列:Redhat.Centos.Fedora等   2.Debian系列:Debi ...

  7. JavaScript中this和$(this)之间的区别以及extend的使用

    jQuery中this和$(this)之间的区别: this返回的是当前对象的html对象,而$(this)返回的是当前对象的jQuery对象 举个正确的Demo实例: $("#textbo ...

  8. linux中fork, source和exec的区别

    转:linux中fork, source和exec的区别 shell的命令可以分为内部命令和外部命令. 内部命令是由特殊的文件格式.def实现的,如cd,ls等.而外部命令是通过系统调用或独立程序实现 ...

  9. [转] C#中out和ref之间的区别

    gskcc 的原文地址 C#中out和ref之间的区别 首先:两者都是按地址传递的,使用后都将改变原来参数的数值. 其次:ref可以把参数的数值传递进函数,但是out是要把参数清空,就是说你无法把一个 ...

  10. Linux中profile与bashrc的作用

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

随机推荐

  1. web.xml 文件头

    Servlet 2.3 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN ...

  2. Integer与int值的比较

    ==一般用于比较内存地址,equals()用于比较Object的值,注意int用equals()是会报错的.Integer i=1Integer k=1i.equals(k)=truei==k=tru ...

  3. Spark源码剖析 - SparkContext的初始化(四)_Hadoop相关配置及Executor环境变量

    4. Hadoop相关配置及Executor环境变量的设置 4.1 Hadoop相关配置信息 默认情况下,Spark使用HDFS作为分布式文件系统,所以需要获取Hadoop相关配置信息的代码如下: 获 ...

  4. 转载 --- SKLearn中预测准确率函数介绍

    混淆矩阵 confusion_matrix 下面将一一给出'tp','fp','fn'的具体含义: 准确率: 所有识别为"1"的数据中,正确的比率是多少. 如识别出来100个结果是 ...

  5. 前端自动化准备和详细配置(NVM、NPM/CNPM、NodeJs、NRM、WebPack、Gulp/Grunt、Git/SVN)

    一. 各类概念和指令介绍 1. NVM (1).  全称:Node Version Manager,是一款针对Nodejs的版本管理工具,由于Node的版本很多,很多时候我要需要依赖多个版本,并且要求 ...

  6. while循环、格式化输出、运算符和编码初识

    while循环 1. while循环的结构 while 条件: 执行语句1 执行语句2 i = 0 while i < 10: print(i) i += 1 运行结果 0 1 2 3 4 5 ...

  7. C#编程思想(持续更新)

    1.将约束的参数先用变量保存,一定不变的设为const,在使用时不直接填入数字而是使用这些变量,这样可以很大程度上方便后续参数的修改 2.字段先用属性封装后,所有的调用都使用属性而不是字段 3.要返回 ...

  8. Ext.net资源地址

    nuget:https://www.nuget.org/packages/Ext.NET/4.1.0 示例:https://examples1.ext.net/#/GridPanel/WebServi ...

  9. php 随机生成数字字母组合

    直接上代码: function getRandomString($len, $chars=null) { if (is_null($chars)) { $chars = "abcdefghi ...

  10. linux 如何保持兼容性

    参考链接:   https://www.cnblogs.com/MYSQLZOUQI/p/5383594.html