1、.bashrc:交互式非登录Shell的配置文件 1.1、什么是.bashrc? bashrc 文件用于配置函数或别名。bashrc 文件有两种级别: 系统级:位于/etc/bashrc,对所有用户生效。 用户级:位于~/.bashrc,仅对当前用户生效 bashrc 文件只会对指定的 shell 类型起作用,bashrc只会被 bash shell 调用,用于
当Bash 作为交互式非登录 shell 启动时,如果~/.bashrc文件存在并且可读,那么它从~/.bashrc文件中读取并执行命令。 三、.bashrc 和 .bash_profile 的不同 在Bash 作为一个交互式登录 shell 启动时,.bash_profile被读取,并且执行,而.bashrc在交互式非登录 shell 启动时被执行。 使用.bash_profile运行仅仅需要运行...
if that file exists. This may be inhibited by using the –norc option. The –rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.
Bash 只能读取~/.bash_profile,如果文件不存在,Bash 会读取~/.profile。 ~/.profile在 Linux 发行版中比~/.bash_profile更常用,因为它被所有 shell 读取和执行。相反,~/.bash_profile只能由 Bash 读取和执行。 当shell 作为交互式非登录 shell 启动时,它会从~/.bashrc文件中读取并执行命令。 ~/.bash_profil...
在Linux中,.bash_profile和.bashrc的主要区别如下:读取时机不同:.bash_profile:在用户每次登录系统时被读取。无论是通过图形界面登录还是通过命令行界面登录,.bash_profile都会被执行。.bashrc:在bash shell调用另一个bash shell时被读取。例如,在已经打开的shell中键入bash命令启动一个新shell时,....
.bash_profile和.bashrc是两个不同的文件,它们在Linux系统中用来配置用户的环境变量和启动脚本。1. .bash_profile:这个文件是用户登录时执行的。当用户登录到系统时...
区别就是 .bash_profile 是login shell的配置文件,而 .bashrc 是交互式non-login shell的配置文件。 当在控制台通过键入用户名和密码的方式登录时,无论是本地登录还是通过ssh远程登录,在初始命令提示符之前会执行 .bash_profile 以配置 shell。 当已经登入机器,并新建一个终端窗口时,在窗口命令提示符之前会执行 ...
常规配置 .bash_profile和.bashrc的区别 .bash_profile和.bashrc的区别 " /etc/profile 此文件/e为t系c/统p的ro每f个il用e.户d设目置录环的境配信置息文,当件用中户搜第集一s次h登e录l时l的,该设文置件.被执行.并从 /etc/bashrc 为每一个运行bash shell的用户执行此文件.当bash shell被打开时,...
系统级的bash_profile和bashrc配置文件对所有用户有影响。在bash_profile里设置的环境变量具有全局性。bashrc里设置的一些变量可能仅在当前会话有效。若bash_profile和bashrc有重复设置,以最后读取的为准。可以通过在bash_profile中添加语句来调用bashrc文件。新手可借助修改bash_profile来快速入门环境配置。 熟练用户则能...
1. 按照传统,您得将定义的变量,如 PATH ,放到’.bash_profile’中,而象 aliases(别名)和函数之类,则放在’.bashrc’。但由于’.bash_profile’经常被设置成先读取’.bashrc’的内容,您如果图省事的话,就把所有配置都放进’.bashrc’. 2. 系统级的设置存储在’/etc/profile’、’/etc/bashrc’及目录’/et...