Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 11 down vote accepted

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 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 there you can just create it. But as i understand the default .bash_profile now is 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

share|improve this answer
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 '10 at 22:57
add comment

Try

man bash

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.