Francisco Machado
Francisco Machado

Reputation: 23

What should I do to load specific bash_profile everytime I open a new Terminal window?

I've created some aliases in a bash_profile (followed this) but when I open a new Terminal i need to write source ~/.bash_profile to use them.

I'd like to use the aliases as soon as I opened new Terminal windows, what should I do?

Upvotes: 0

Views: 887

Answers (1)

Benjamin Scholtz
Benjamin Scholtz

Reputation: 823

Josh Staiger gives a good summary in his blogpost ".bash_profile vs .bashrc", summarised below:

  • .bash_profile is executed when a user logs in via the console
  • .bashrc is executed whenever a logged in user opens a new terminal window

So if you'd like to use newly created aliases as soon as you open a new terminal window, the solution is to use .bashrc instead of .bash_profile for your aliases.

The blog post includes some more details about synchronising PATHs that you set in .bashrc for logged in and non logged in shells, that may or may not be relevant to your specific problem.

Upvotes: 3

Related Questions