Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have added some new commands to ~/.bash_profile but every time I start a new terminal session, it seems to forget these commands and I have to do . ~/.bash_profile again. Is there a way to avoid this doing every single terminal session?


share|improve this question
up vote 4 down vote accepted

I don't know why ~/.bash_profile is getting overwritten, but I've had problems with it before too. Instead, use ~/.bashrc.

What I do is create the file ~/.bashrc2. In that file I put all my custom commands. After you have what you want, edit ~/.bashrc and add this line at the bottom:

. ~/.bashrc2

Even if ~/.bashrc gets modified, it won't hurt your customizations. Now you have a portable customization file that you can take to any computer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.