Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: How do i edit my .bash_profile file?

  1. #1
    Join Date
    Feb 2011
    Beans
    91

    How do i edit my .bash_profile file?

    Hey there,

    Can someone please tell me how to edit my .bash_profile file, so that i add a command: export PATH=$PATH:/home/bin so that this existing directory is added to my path for good? I dont know how to open the .bash_profile file.

    Thanks

  2. #2
    Join Date
    Dec 2006
    Beans
    7,342

    Re: How do i edit my .bash_profile file?

    Simply use your favourite text editor, such as gedit. I have a similar setting but I will admit that my own is actually in $HOME/.bashrc, my $HOME/.bash_profile is as follows:

    Code:
    if [ -f $HOME/.bashrc ]; then
    source $HOME/.bashrc
    fi
    Andrew
    You think that's air you're breathing now?

  3. #3
    Join Date
    Feb 2011
    Beans
    91

    Re: How do i edit my .bash_profile file?

    Thanks Andrew, im not sure i understand your code as im new to scripting, but i do know how to use my text editor, Vim. Do i just type the code you said into Vim and that will open a file called .bash_profile? Then type the command i first said into that? Cheers

  4. #4
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,617
    Distro
    Ubuntu

    Re: How do i edit my .bash_profile file?

    I think Andrew is advising you to put you $PATH entry in ~/.bashrc instead.
    Code:
    vim ~/.bashrc
    Put your path variable in that, then either log out and back in or get bash to read your new bashrc

    Code:
    . ~/.bashrc

  5. #5
    Join Date
    Feb 2011
    Beans
    91

    Re: How do i edit my .bash_profile file?

    Instead of Andrews HOME would i type /home/bin? I just must have to type /home/bin into the code somehwere. Thanks guys. What does rc stand for? Whats the difference between Andrews way and the way the tutorial does it? Thank you

  6. #6
    Join Date
    Dec 2006
    Beans
    7,342

    Re: How do i edit my .bash_profile file?

    Quote Originally Posted by btf18 View Post
    Instead of Andrews HOME would i type /home/bin? I just must have to type /home/bin into the code somehwere. Thanks guys. What does rc stand for? Whats the difference between Andrews way and the way the tutorial does it? Thank you
    Actually $HOME is a variable that will expand out to the correct path. Try the following command and it should all become clear:

    Code:
    andrew@skamandros~$ echo $HOME
    /home/andrew
    rc files are for the most part configuration files, a nice read on the subject here:

    Configuration file
    http://en.wikipedia.org/wiki/Configuration_file

    As for the tutorial, can you give a link?
    You think that's air you're breathing now?

  7. #7
    Join Date
    Feb 2011
    Beans
    91

    Re: How do i edit my .bash_profile file?

    Thanks Andrew. I want home/bin in my paths, will HOME just put home/username in my paths?

  8. #8
    Join Date
    Feb 2011
    Beans
    91

    Re: How do i edit my .bash_profile file?

    Could you please tell me the exact code to type and where, remembering my directory to add to paths is /home/bin. thanks. This method is not the same as the tutorial does. And what is ./? It's always used to open files. i know its a directory. I know / is the root directory, but what does the . mean in ./? I just want to know how to edit my .bash_profile, I dont even know how to open my .bash_profile and view it. im confused as to the comments. Im new lol
    Last edited by btf18; March 17th, 2011 at 02:30 AM.

  9. #9
    Join Date
    Feb 2011
    Beans
    91

    Re: How do i edit my .bash_profile file?

    If i could just edit my .bash_profile to include the command in my first message. Thanks

  10. #10
    Join Date
    Dec 2006
    Beans
    7,342

    Re: How do i edit my .bash_profile file?

    If you look a little further down in the guide you have used you will see that the author of the guide also warns against use of PATH commands in $HOME/.bash_profile:

    Though placing your aliases and shell functions in your .bash_profile will work, it is not considered good form. There is a separate file named .bashrc that is intended to be used for such things.
    and then goes on to give a variation of the condition that I suggested for your $HOME/.bash_profile.

    Andrew
    You think that's air you're breathing now?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •