/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc很容易混淆,他们之间有什么区别?它们的作用到底是什么?

/etc/profile: 用来设置系统环境参数,比如$PATH. 这里面的环境变量是对系统内所有用户生效的。
/etc/bashrc:  这个文件设置系统bash shell相关的东西,对系统内所有用户生效。只要用户运行bash命令,那么这里面的东西就在起作用。
~/.bash_profile: 用来设置一些环境变量,功能和/etc/profile 类似,但是这个是针对用户来设定的,也就是说,你在/home/user1/.bash_profile 中设定了环境变量,那么这个环境变量只针对 user1 这个用户生效.
~/.bashrc: 作用类似于/etc/bashrc, 只是针对用户自己而言,不对其他用户生效。

另外/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是"父子"关系.

~/.bash_profile 是交互式、login 方式进入 bash 运行的,意思是只有用户登录时才会生效。
~/.bashrc 是交互式 non-login 方式进入 bash 运行的,用户不一定登录,只要以该用户身份运行命令行就会读取该文件。

/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc的更多相关文章

  1. /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 的区别(转)

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

  2. 浅析Linux下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc文件

    转自:http://www.ahlinux.com/shell/20239.html 0x01 /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行,并从/e ...

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

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

  4. /etc/profile、~/.bash_profile、~/.bashrc和/etc/bashrc

    文件 引用关系 执行时间 影响用户 使用场景 /etc/profile   开机执行 所有用户 所有用户.重启生效 ~/.bash_profile 引用~/.bashrc 用户登录时执行 当前用户 当 ...

  5. /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件的作用

     转载自:http://blog.csdn.net/u013968345/article/details/21262033 /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登 ...

  6. linux命令(24):/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc

    /etc/profile./etc/bashrc.~/.bash_profile.~/.bashrc很容易混淆,他们之间有什么区别?它们的作用到底是什么? /etc/profile: 用来设置系统环境 ...

  7. inux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件的作用

    /etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取. ~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的sh ...

  8. linux下/etc/profile、/etc/bashrc、~/.bashrc 和~/.bash_profile文件的区别

    这个一定要理解登录式shell和非登录式shell的区别,前者是完全切换用户,后者是不完全,就算切换过来了,你pwd时家目录还是之前的家目录,所以 登录式顺序为:/etc/bashrc---/etc/ ...

  9. Linux之profile、bash_profile、bashrc文件

    来自: profile.bash_profile.bashrc文件的作用与区别 1. profile 文件 1.1 profile 文件的作用 profile(/etc/profile),用于设置系统 ...

随机推荐

  1. PythonS12-day4学习笔记

    # 迭代器.装饰器.生成器 # 迭代器 li = [1, 3, 'he', '&'] n = iter(li) print(n.__next__()) import os, sys # 生成器 ...

  2. 问题:C++形参默认值为什么一定要放在最后?

    问题:C++形参默认值为什么一定要放在最后? 1.会出现歧义! 2.从汇编角度看是怎么回事?   待解答!!

  3. The Non-Inverting Amplifier Output Resistance by Adrian S. Nastase [ Copied ]

    Source Address: http://masteringelectronicsdesign.com/the-non-inverting-amplifier-output-resistance/ ...

  4. 在ASP.NET MVC中,使用Bundle来打包压缩js和css

    该总结参考博文地址:http://www.cnblogs.com/xwgli/p/3296809.html 1.首先了解Bundle的作用:Bundles用于打包CSS和javascript脚本文件, ...

  5. encode和decode的区别

    $octets = encode("iso-8859-1", $string);把一个串从perl内部格式转为iso-8859-1格式$string = decode(" ...

  6. CSS3实现边框锯齿效果

    通过CSS3的linear-gradient实现的 <div class="bg"></div> .bg{ width:300px; height:50px ...

  7. nodeType、nodeName和nodeValue

    首先了解一下DOM中有三大节点,分别是 元素节点,文本节点,属性节点 元素节点:构成了DOM的基础.文档结构中,<html>是根元素,代表整个文档,其他的还有<head>,&l ...

  8. gulp使用

    卸载插件:npm uninstall <name> [--save-dev]使用npm更新插件:npm update <name> [--save-dev]更新全部插件:npm ...

  9. CE STEPLDR

    作用:初始化CPU.内存.Flash,复制EBoot到内存并跳入EBoot中运行. 原理:S3C2416有 8-KB 的steppingstone(暂时翻译为垫脚石),在Nand启动模式下可把Nand ...

  10. cx_oracle 执行cur.execute(sql)提交数据出现 UnicodeEncodeError: 'ascii' codec can't encode character u'\u2122' in position 170

    还是中文字符的问题, 解决方法见链接:http://www.oracle.com/technetwork/articles/tuininga-cx-oracle-084866.html import ...