centos bash.bashrc空白了怎么办

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos bash.bashrc空白了怎么办相关的知识,希望对你有一定的参考价值。

参考技术A login shell 和 no-login shell

“login shell” 代表用户登入, 比如使用 “su -“ 命令, 或者用 ssh 连接到某一个服务器上, 都会使用该用户默认 shell 启动 login shell 模式.
该模式下的 shell 会去自动执行 /etc/profile 和 ~/.profile 文件, 但不会执行任何的 bashrc 文件, 所以一般再 /etc/profile 或者 ~/.profile 里我们会手动去 source bashrc 文件.
而 no-login shell 的情况是我们在终端下直接输入 bash 或者 bash -c “CMD” 来启动的 shell.
该模式下是不会自动去运行任何的 profile 文件.本回答被提问者采纳

CentOS6 /etc/profile ~/.bash_profile ~/.bashrc等文件的执行顺序

交互式登陆shell的执行顺序:/etc/profile -> ~/.bash_profile -> ~/.bashrc -> /etc/bashrc ->  ~/.bash_logout (退出时执行)

 

交互式非登陆shell的执行顺序:~/.bashrc -> /etc/bashrc

 

在非交互模式下,bash读取的startup文件由环境变量BASH_ENV来决定

 

 

参考:http://yujia2016.blog.51cto.com/59379/1775070

      http://www.cnblogs.com/cute/archive/2011/03/17/1987278.html

      

 

以上是关于centos bash.bashrc空白了怎么办的主要内容,如果未能解决你的问题,请参考以下文章

自定义shell终端提示符及颜色 (以Centos为例)

centos系统怎和切换图形界面

配置开机自启命令文件~/.bashrc/etc/profile/etc/bash.bashrc的异同(bashrc:Bash Run Commands)

配置开机自启命令文件~/.bashrc/etc/profile/etc/bash.bashrc的异同(bashrc:Bash Run Commands)

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

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