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?



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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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