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
Where Is Bashrc File in Linux? As we mentioned, the location of bashrc is in your home directory. When a bash shell or a bash script is initiated, it will read and execute.
bash_profile is used for customizing the user configuration settings. This file is located in the home directory and is mostly hidden. The . bash_profile files are considered as configuration scripts.
Bash Configuration ScriptsWhen bash starts, it runs one or more scripts in order to setup the user's environment variables, any aliases, and what programs to run at startup. This post explains what scripts are involved, when they're executed, and what to put in them.
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
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.
As some people said, those files are in the home directory.
(Screenshot from Wiki article.)
I'll tell you here how to find it (the explanation here is for Windows 10 only), which is my system.
You can quickly find and open some of those locations with the following commands (using bash console):
cd ~
← It will take you to your home directory.ls -a
← It will display files and folders, both visible and hidden.explorer .
← It will open the home folder in Windows Explorer, which can be really useful. Look for the file/folder you need. Move to it using:cd folder-name
or open the file in the text editor using notepad file-name
. For your case, you should find and open notepad .bashrc
Those files are in the user's home directory.
$HOME/.profile
$HOME/.bashrc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With