Ubuntu bashrc文件如何找到使用的文件?
启动shell时,如何查找加载了哪个Ubuntu bashrc文件如何找到使用的文件?,ubuntu,ubuntu-10.04,Ubuntu,Ubuntu 10.04,启动shell时,如何查找加载了哪个.bashrc文件? 有什么命令可以告诉我吗 目前我认为它是/root/.bashrc它是一个Ubuntu服务器10.04 LTS 它是基于用户的还是基于用户的 从这里看来,除非您以root身份登录,否则您的~/.bashrc将运行,因为/root/是root的家。只需使用echo即可。将表达式放入bashrc echo "I am in $PWD/$0" or "I am in bashrc file". 这样,您将在登录打印消息时看到,打印消息将确认流程
.bashrc
文件?
有什么命令可以告诉我吗
目前我认为它是/root/.bashrc
它是一个Ubuntu服务器10.04 LTS
它是基于用户的还是基于用户的 从这里看来,除非您以root身份登录,否则您的
~/.bashrc
将运行,因为/root/
是root的家。只需使用echo即可。将表达式放入bashrc
echo "I am in $PWD/$0" or "I am in bashrc file".
这样,您将在登录打印消息时看到,打印消息将确认流程使用特定的脚本文件。注意-例如,从bashrc或bash_profile启动程序是不明智的,因为如果程序由于某种原因无法启动或无法启动,您将无法进入外壳。您寻求的命令是
man bash
,它告诉您:
When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
及
好的,如果我以“someuser”的身份登录,那么它是使用/home/someuser/.bashrc中的.bashrc来登录的。bashrc_配置文件呢?通常,在shell启动时会使用各种文件(如果存在)。根据您将语句放在哪里,您可能会发现使用了/etc/bashrc、/etc/bash/rcfile、/etc/profile、/etc/bash\u completion.d/someother文件、~/.bashrc、~/.profile、~/.bash\u profile等。“root”用户通常具有~/.profile,而普通用户则具有~/.bash\u profile
When an interactive shell that is not a login shell is started, bash
reads and executes commands from ~/.bashrc, 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.