找到我的 bash 配置文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/11629304/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
locate my bash configuration file
提问by JustInTime
Is there a way to find the name of the bash configuration file that is currently on use. I searched for the .profile or .bashrc but did not find them. However still I can print some of the env variables i.e $HOME, $PATH
有没有办法找到当前正在使用的 bash 配置文件的名称。我搜索了 .profile 或 .bashrc 但没有找到它们。但是我仍然可以打印一些环境变量,即 $HOME, $PATH
回答by ajreal
If you are using one of these sudo su -, bash --login, ssh user@host,
these are considered as login shell,
then you might want to try
如果您正在使用这些sudo su -, bash --login, 之一ssh user@host,
这些被视为登录 shell,
那么您可能想尝试
- /etc/profile
 - ~/.bash_profile
 - ~/.bash_login
 - ~/.profile
 
- /etc/配置文件
 - ~/.bash_profile
 - ~/.bash_login
 - ~/.profile
 
回答by sat
Environment variables are stored in the each process itself.$HOME and $PATH is stored in the bash process itself.
环境变量存储在每个进程本身中。$HOME 和 $PATH 存储在 bash 进程本身中。
So,First you have to find process id of your bash process.You can use pscommand to get the process id of the process.
Then,
所以,首先你必须找到你的 bash 进程的进程 id。你可以使用ps命令来获取进程的进程 id。然后,
 cat /proc/your_bash_process_id/environ
I hope this will helps you.
我希望这会帮助你。
回答by A.G.
Those files are in the user's home directory.
这些文件位于用户的主目录中。
$HOME/.profile
$HOME/.bashrc
$HOME/.profile
$HOME/.bashrc

