I can't find .bash_profile [duplicate]

If you open Nautilus, the file browser, go to your HOME directory and press CTRL+H you will see then all the hidden files (since hidden files start with the DOT . character). Since you are talking about the .bash_profile, I am guessing you want to start via console instead of an interactive desktop.

The difference between .bash_profile and .bashrc is the following:

  • .bashrc is the one that you edit when you want to change the way xterm or gnome-terminal open the console. how the bash works in this interactive places.

  • .bash_profile is the one you edit when you want to change how bash works when you login via console (Like the same way you login to a Ubuntu server or when you press CTRL+ALT+F1 to start a terminal)

Since .bash_profile does not come by default, you can just create it. But as I understand the default .bash_profile is now called .profile which can be seen in the HOME directory. Both, .bashrc and .profile can be edited to change how bash works in both, interactive and console modes.

NOTE: If by some way you create .bash_profile, then Ubuntu wont read .profile but instead go directly to .bash_profile since both of them are the same but .bash_profile has more compatibility because of old ways. So basically you do not need .bash_profile if you have .profile. So just remember:

.bashrc - Interactive Console/Terminal (Gnome, KDE, Xfce...)

.profile - TTY Console/Terminal


Try

man bash

and look at the INVOCATION section. That will explain how bash starts up.


Look at .profile instead. I believe it loads that first then .bashrc.

.profile is loaded with each login. .bashrc is invoked with each subshell creation, including any subshells created within vi, emacs etc.