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 want to append the directory /home/bart/bin to my PATH. By my PATH, I mean that it should be available whenever I login, whether it be via the terminal, Gnome, KDE or SSH, but not for other users. What's the recommended way of doing this?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

Append your directory to PATH in /home/<user name>/.bashrc and source .bashrc from /home/<user name>/.profile using

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

This way your changes will be available to you only in both GNOME & KDE and also in bash.

Do not edit /etc/profile as it will make the changes for all users.

share|improve this answer
    
Well, what do you know, apparently .profile already contains by default: # set PATH so it includes user's private bin if it exists \n if [ -d "$HOME/bin" ] ; then \n PATH="$HOME/bin:$PATH" \n fi –  Bart van Heukelom Dec 30 '10 at 13:00
add comment

Adding the appropriate line in .bashrc in your home folder should be enough for terminal and ssh. However, i don't understand how your path will make a difference in Gnome(maybe it might in the run utility, but not sure about it).

Add the line PATH=/home/bart/bin:$PATH in your .bashrc. Run source ~/.bashrc to test the new path settings if you change .bashrc from the terminal.

share|improve this answer
    
Indeed, that won't work for the run utility –  Bart van Heukelom Dec 30 '10 at 10:22
    
Look at ubuntuforums.org/showthread.php?t=969, it talks about changing /etc/profile, that may help you. –  apoorv020 Dec 30 '10 at 10:26
    
It works for me. I just ran a script in the run dialog from ~/bin, which is only sourced in ~/.profile. I just made a quick script to say some things with espeak and it did. If you just created ~/bin you may need to log out. –  Deadite81 Dec 30 '10 at 10:27
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.