Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

locate my bash configuration file

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

like image 588
JustInTime Avatar asked Jul 24 '12 10:07

JustInTime


People also ask

Where is bash file in Linux?

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.

Where is my bash_profile Linux?

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.

What is bash configuration?

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.


4 Answers

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
like image 167
ajreal Avatar answered Oct 21 '22 19:10

ajreal


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.

like image 38
sat Avatar answered Oct 21 '22 21:10

sat


As some people said, those files are in the home directory.

enter image description here

(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
like image 2
carloswm85 Avatar answered Oct 21 '22 19:10

carloswm85


Those files are in the user's home directory.

$HOME/.profile

$HOME/.bashrc

like image 1
A.G. Avatar answered Oct 21 '22 19:10

A.G.