سؤال

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

هل كانت مفيدة؟

المحلول

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

  1. /etc/profile
  2. ~/.bash_profile
  3. ~/.bash_login
  4. ~/.profile

نصائح أخرى

Environment variables are stored in the each process itself.$HOME and $PATH is stored in the bash process itself.

So,First you have to find process id of your bash process.You can use ps command to get the process id of the process. Then,

 cat /proc/your_bash_process_id/environ

I hope this will helps you.

Those files are in the user's home directory.

$HOME/.profile

$HOME/.bashrc

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top