13

I am trying to learn how to tweak my shell in the file but can't seems to find the file in my home directory or in /etc/profile.

Is there any other file I need to search for, or am I expected to create one from scratch?

0

3 Answers 3

24

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

1
  • 2
    thx you are right i continude to read a little bit and found out that bash has a certain sequence it boots into first it tries to find .bash_profile if not found it tries to find .bash_login and if not found it tries to find .profile, and another thing i read is if you do create .bash_profile you can insert "source .profile" command at the end of .bash_profile and it should execute .profile afterwards, but it's all from reading a book, so not sure how much it will work
    – david25
    Dec 10, 2010 at 22:57
1

Try

man bash

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

1

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.

Not the answer you're looking for? Browse other questions tagged .