`
cppmule
  • 浏览: 436417 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

/etc/profile,.bash_profile与.bashrc作用的区别

阅读更多
1)/etc/profile: 此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行. 并从/etc/profile.d目录的配置文件中搜集shell的设置。
(2)/etc/bashrc: 为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取。
(3)~/.bash_profile: 每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件。
(4)~/.bashrc: 该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该该文件被读取。
(5)~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件. 另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是"父子"关系。
(6)~/.bash_profile 是交互式、login 方式进入 bash 运行的~/.bashrc 是交互式 non-login 方式进入 bash 运行的通常二者设置大致相同,所以通常前者会调用后者。
分享到:
评论

相关推荐

    浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc

    浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc

    bashprofile与bashrc.doc

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

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

    /etc/bashrc 每个运行bash shell的用户都执行此文件,当bsh被打开时,该文件被读取; ~/.bash_profile 专用于本用户的shell信息,仅被执行一次; ~/.bashrc 文件包含本用户的bsh信息,登录及每次打开shell时被读取。

    Linux 环境变量详解及实例

    ~/.bash_profile && ~/.bashrc 用户登陆Linux操作系统的时候,”/etc/profile”, “~/.bash_profile”等配置文件会被自动执行。 执行过程是这样的: 登陆Linux系统时,首先启动”/etc/profile”, 然后启动用户...

    Linux下环境变量配置方法小结(.bash_profile和.bashrc的区别)

    1)修改/etc/profile文件 推荐使用这种方法,因为所有用户的shell都有权使用这些环境变量,缺点是可能会给系统带来安全性问题。 这里是针对所有的用户的,所有的shell; [root@test ~]# vim /etc/profile …. expo

    Linux配置java.doc

    linux在启动过程中,会先执行/etc/profile文件,然后执行用户目录下的~/.bash_profile、~/bash_login、~/.profile中的其中一个(执行优先级为从左到右)。如果~/.bash_profile文件存在的话,一般还会执行~/.bashrc。...

    AwesomeCustomBashProfile

    ~/.bash_ultrawalkerfi~/.bashrc 文件可能因您的发行版而异,请记住.bashrc 包含在所有其他文件中,例如 .bash_profile /etc/bash.bashrc 包含在 .bashrc 中,所以/etc/bash.bashrc > ~/.bashrc > ~/.bash_profile

    Linux 添加开机启动方法(服务/脚本)

    /etc/profile、/root/.bash_profile /etc/bashrc、/root/.bashrc /etc/profile.d/*.sh、/etc/profile.d/lang.sh /etc/sysconfig/i18n、/etc/rc.local(/etc/rc.d/rc.local) 一、修改开机启动文件:/etc/rc.local...

    Linux 中环境变量设置.docx

    /etc/profile: 此文件为系统的每个用户设置环境信息,当用户... 另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是"父子"关系。

    ubuntu配置文件备份

    ~/.bashrc:/etc/profile:/etc/vim/vimrc:/etc/bash.bashrc

    linux期中考試

    /etc/passwd C./etc/group D. /etc/profile 3. csh启动时,自动执行用户主目录下( A )文件中命令。 A. .cshrc B. .logout C. autoexec D. config 4. 一般来说,设备文件所在的目录是( D ) A./home/root B./home C...

    pgbackrest-bash-completion:pgBackRest的Bash完成

    复制pgbackrest-completion.sh在bash_completion.d文件夹( /etc/bash_completion.d , /usr/local/etc/bash_completion.d或~/bash_completion.d )。 或者在您的~/.bashrc或~/.profile加载pgbackrest-completion....

    配置环境_CodingPark

    /etc/profile b. /etc/paths c. ~/.bash_profile d. ~/.bash_login e. ~/.profile f. ~/.bashrc 其中a和b是系统级别的,系统启动就会加载,其余是用户接别的。 c,d,e按照从前往后的顺序读取,如果c文件存在,则后面...

    dotenv:MacOS dotenv文件,PS1,shell辅助程序,加载程序等

    < EOF>> ~/.bash_profile[[ -r ~/.bash_load ]] && . ~/.bash_load[[ -r ~/.bashrc ]] && . ~/.bashrcEOF 从/etc/bashrc删除或注释掉~/.bashrc任何来源。将现有文件添加到此仓库中最简单的事情是将文件移动到src然后

    history保存用户操作日志,登陆时间,防止会话退出时覆盖

    以下是代码: #说明: /etc/profile 中结尾添加如果下指令 ...#HISTSIZE:表示最多可以存多少条命令(先进先出),可以在/etc/bashrc和~/.bash_profile里面设置(1000000不会报错)。 export HISTSIZE=10000 #HISTTIMEFORMA

    shell一些环境配置文件的说明。

    假如用户的根目录里存在这个文件, bash就在读取完/etc/profile后加载这个配置文件.如果这个文件不存在, bash就会查找另一个用户自定义文件.bash_login并且加载它. 如果.bash_login文件也不存在, 则加载.profile(...

    点文件

    点文件 安装vim插件的步骤: 光盘〜 运行:git clone :tabletenniser / dotfiles.git 对于只读存储库,请使用ssh:... 设置.bashrc,.bashprofile,.gitconfig,.dircolors的步骤: ln -s〜/ dotfiles / .bashrc〜/

    shell-path:从外壳获取$ PATH

    对于Electron / NW.js应用程序很有用,因为macOS上的GUI应用程序不会继承点文件(.bashrc / .bash_profile / .zshrc / etc)中定义的$PATH 。 安装 $ npm install --save shell-path 用法 在macOS上从GUI应用执行时...

    Linux下设置环境变量各配置文件的区别

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

Global site tag (gtag.js) - Google Analytics