Linux - Laptop and NetbookHaving a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Isn't a ./bash_profile created in debian lenny at start up ?
I know that I have a /etc/profile but isn't that more system specific as opposed to user specific?
I don't even have a bashrc file but a bash.bashrc file.
What is the difference between the two ?
I need to add a few lines in my profile but I am really confused as to where.
Shall I just create ./bash_profile or inputing the few lines I have to input would sort me out?
1) The files in /etc are system-wide settings, so they get loaded first. Files in a user's home directory apply only to that user, and get applied later, overriding the ones from /etc if necessary.
2) /etc/profile is the non-bash-specific login shell config. It will be read by all shells when you log directly into a system, such as when you switch to a terminal with crtl+alt+FN as opposed to calling up a console window. A standard procedure is to have the profile import your bashrc so you can have your bash settings available there too.
3) /etc/bashrc is only directly loaded by non-login shells. /etc/bash.bashrc is just Debian's way of naming the file. It's the same thing. Most people keep their system-wide aliases and settings here.
4) The file you're looking for is not "./bash_profile", it's "~/.bash_profile", a hidden file inside the home directory. Notice the period is at the beginning of the filename, not the directory separator. ./filename simply points to a file in the current directory. You need to use the "ls -a" option to see hidden files in the shell. .bash_profile is a user-level configuration for login shells. Mine contains this:
Code:
david:~$ cat ./.bash_profile
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/login.defs
#umask 022
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
david:~$
Notice the line that will import ~/.bashrc contents if that file exists.
5) So to make a long story short, if you want your settings to be systemwide, the best option is to put them in /etc/bash.bashrc, and make sure they're sourced in /etc/profile. Similarly, if you want them for the current user only, put them in ~/.bashrc and source that file in your ~/.bash_profile.
1) The files in /etc are system-wide settings, so they get loaded first. Files in a user's home directory apply only to that user, and get applied later, overriding the ones from /etc if necessary.
2) /etc/profile is the non-bash-specific login shell config. It will be read by all shells when you log directly into a system, such as when you switch to a terminal with crtl+alt+FN as opposed to calling up a console window. A standard procedure is to have the profile import your bashrc so you can have your bash settings available there too.
3) /etc/bashrc is only directly loaded by non-login shells. /etc/bash.bashrc is just Debian's way of naming the file. It's the same thing. Most people keep their system-wide aliases and settings here.
4) The file you're looking for is not "./bash_profile", it's "~/.bash_profile", a hidden file inside the home directory. Notice the period is at the beginning of the filename, not the directory separator. ./filename simply points to a file in the current directory. You need to use the "ls -a" option to see hidden files in the shell. .bash_profile is a user-level configuration for login shells. Mine contains this:
Code:
david:~$ cat ./.bash_profile
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/login.defs
#umask 022
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
david:~$
Notice the line that will import ~/.bashrc contents if that file exists.
5) So to make a long story short, if you want your settings to be systemwide, the best option is to put them in /etc/bash.bashrc, and make sure they're sourced in /etc/profile. Similarly, if you want them for the current user only, put them in ~/.bashrc and source that file in your ~/.bash_profile.
I did check within my home directory and found a ~/.bashrc but didn't find any ~/.bash_profile. I have added my lines in ~/.bashrc. As you said, ~/.bashrc is supposed to be source by ~/.bash_profile. Since I don't have one, it would make sense for me to create one, but I am not sure that is right way to do it in Debian ?
to make it a bit clearer, I have an app that needs to find java on my eeepc on order to run.
I ran java -version --> it did tell me that I had java install 'java version 1.5.0'
then i found out where it was installed with which java --> /usr/bin/java
so I figured that the app couldn't find it in my profile (user specific) --> the error message of the app is 'check your installation and use +javahome to specify the JDK or JRE location'
then I added the lines in ~/.bashrc as followed
export JAVA_HOME=/usr/bin/java
export PATH=$PATH:/usr/bin/java
I logged out and back in and checked with echo $JAVA_HOME and echo $PATH --> but nothing
So two questions come to my mind. Is it because I haven't source ~/.bashrc in ~/.bash_profile ? and/or do I have to uninstalled my version of Java and install the version on the Java website ?
Riganta
Last edited by riganta; 01-14-2009 at 05:52 AM.
Reason: clarity
If you don't have a ~/.bash_profile but have a ~/.profile script, then ~/.profile will be run instead. Read the beginning of "info bash". The alterate login scripts, .bashprofile, .profile and .bash_login are mentioned near the beginning. Only one is used but one may source another. /etc/profile and ~/.profile are run when you log in. The ~/.bashrc script is run when you start up a new subshell. Commands like "PATH=$PATH:/usr/local/bin" are better in ~/.profile rather than ~/.bashrc so that they run only once.
Be sure to check which startup scripts you have. Check them all, ~/.bashrc, ~/.bash_login, ~/.bash_profile and see which you have and check which has precedence.
If you can run "/bin/bash" and then you see PATH is "/usr/bin/java", then the problem is that your login script isn't sourcing .bashrc when you login.
However, it is odd that you don't have anything defined for PATH. It should have /bin/ and /usr/bin/ in the path. Check that you don't have a space after the "=" sign in the command. It would be interpreted as two commands,
PATH=
$PATH:/usr/local/bin
which would probably cause an error. But the first "PATH= " would clear the PATH variable.
If you don't have a ~/.bash_profile but have a ~/.profile script, then ~/.profile will be run instead. Read the beginning of "info bash". The alterate login scripts, .bashprofile, .profile and .bash_login are mentioned near the beginning. Only one is used but one may source another. /etc/profile and ~/.profile are run when you log in. The ~/.bashrc script is run when you start up a new subshell. Commands like "PATH=$PATH:/usr/local/bin" are better in ~/.profile rather than ~/.bashrc so that they run only once.
Be sure to check which startup scripts you have. Check them all, ~/.bashrc, ~/.bash_login, ~/.bash_profile and see which you have and check which has precedence.
If you can run "/bin/bash" and then you see PATH is "/usr/bin/java", then the problem is that your login script isn't sourcing .bashrc when you login.
However, it is odd that you don't have anything defined for PATH. It should have /bin/ and /usr/bin/ in the path. Check that you don't have a space after the "=" sign in the command. It would be interpreted as two commands,
PATH=
$PATH:/usr/local/bin
which would probably cause an error. But the first "PATH= " would clear the PATH variable.
when I do a ls -a in my home directory, this is what I get
.profile: executed by bourne compatible login shell
script:
if [ "$BASH" ]; then
if [ -f -/.basshrc ]; then
.~/.bashrc
fi
fi
mesg n
would that mean that basically when .profile is launched, it sources .~/.bashrc ?
what would the mesg n means ?
.bashrc: executed by bash for non-login shells
script:
export PS1='\h:\w\$ '
unmask 022
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
I have added those three last lines for my apps to work with Java and for PATH but with no success
the reason why I added those lines below is that when I ran 'update-alternatives --config java' i found out that my system was using java with PATH as follow '/usr/lib/jvm/java-gcj/jre/bin/java'. So I created a simlink of that into /usr/lib/java that I placed in ~./bashrc.
Do I have to delete those lines in ~./bashrc since they don't make any difference anyways ?
In many post, I have seen people ditching java included in Debian Lenny for the one on Java website. I wouldn't want to use the one on the Java website but since nothing else as worked... I might as well give it a try.
/etc/profile: system wide .profile file for the Bourne shell and Bourne compatible shell
script:
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi
if [ "$PS1 ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
again, I added the lines for Java in /etc/profile since the ones in ~./bashrc didn't work out, but I don't really if that was the right way.
I am kind of lost at sea here. I am sure that there is a more simple way to make my apps find the path to Java. I thought by using JAVA_HOME I would be sorted but that is not the case. I know that I am not understanding the full picture here and I would surely appreciate some more help.
I thank you all and without you guys I wouldn't be able to move forward at all.
.profile: executed by bourne compatible login shell
script:
if [ "$BASH" ]; then
if [ -f -/.basshrc ]; then
.~/.bashrc
fi
fi
mesg n
Your .profile script has a typo. Since ~/.basshrc doesn't exist, ~/.bashrc isn't being sourced when you log in.
Try starting a subshell (as in running konsole or xterm) and see if it runs then.
Code:
/etc/profile: system wide .profile file for the Bourne shell and Bourne compatible shell
script:
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi
if [ "$PS1 ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
Your /etc/profile script only sets the PATH variable for the root user.
Also the paths added aren't right. Root should have /sbin and /usr/sbin/ it it's path.
Did you rewrite /etc/profile? On some systems, there is an /etc/profile.d/ directory that contains scripts to run for the respective shells. Also, sometimes, the system expects you to leave /etc/profile alone and let it source /etc/profile.local instead.
I don't know what package would have supplied the initial /etc/profile file. On mine it is aaa_base, which may be a traditional name. You might want to find the package and extract the /etc/profile script it has.
.profile: executed by bourne compatible login shell
script:
if [ "$BASH" ]; then
if [ -f -/.basshrc ]; then
.~/.bashrc
fi
fi
mesg n
Your .profile script has a typo. Since ~/.basshrc doesn't exist, ~/.bashrc isn't being sourced when you log in.
Try starting a subshell (as in running konsole or xterm) and see if it runs then.
Code:
/etc/profile: system wide .profile file for the Bourne shell and Bourne compatible shell
script:
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi
if [ "$PS1 ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
Your /etc/profile script only sets the PATH variable for the root user.
Also the paths added aren't right. Root should have /sbin and /usr/sbin/ it it's path.
Did you rewrite /etc/profile? On some systems, there is an /etc/profile.d/ directory that contains scripts to run for the respective shells. Also, sometimes, the system expects you to leave /etc/profile alone and let it source /etc/profile.local instead.
I don't know what package would have supplied the initial /etc/profile file. On mine it is aaa_base, which may be a traditional name. You might want to find the package and extract the /etc/profile script it has.
No, I have not rewrite /etc/profile. I have fixed the typo in ./profile (thanks)
I have downloaded JAVA from the JAVA website and now I cannot even seem to install that version as well
When I run the command " fakeroot make-jpkg jre-6ull-linux-i586.bin" i get the error 'the file doesn't exists' --> I am a non root user
I am really with the java app. Anyone has any idea, that would be much appreciated
I have finally succeeded in making my app find the path to Java binaries
all I did is add the path 'usr/lib/jvm/java-6-openjdk/jre/bin'
to my PATH in /etc/profile. So, that is sorted, but now the app start and stops and I get a very specific error message that says
'Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable set, but this program performed an operation which requires it'
I finally got it working fine. I am quite relief and the answer was insanely straightforward.
- still in /etc/profile, I have two PATH(s)
one that says
I finally got it working fine. I am quite relief and the answer was insanely straightforward.
- still in /etc/profile, I have two PATH(s)
one that says
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.