Find the answer to your Linux question:
Results 1 to 3 of 3
What's the difference between .bash_profile and .bashrc? I have been reading about Linux and some software I've been using, etc. Some of them advise making a certain change in .bashrc, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25

    .bash_profile vs. .bashrc


    What's the difference between .bash_profile and .bashrc?

    I have been reading about Linux and some software I've been using, etc. Some of them advise making a certain change in .bashrc, others suggest making a change in .bash_profile. I also like to modify my environment a little to make it easier for me to use and to make it consistent across different machines.

    The result is that I have several changes scattered through both of those files. Can I consolidate them into one or of them?

    I just noticed that all of my changes in _profile are either of the cursor or are "alias" commands. The changes in rc are export commands. (I bet that's a clue if I was more knowledgeable, huh?)

    The bottom line is I want to know what's the difference between .bash_profile and .bashrc, and can I consolidate my personalizations in one of them?

    Thanks.

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,885
    At its most fundamental, the difference is that .bash_profile is executed when you log in at the terminal prompt, and .bashrc when you start an X session. For some *nix derivatives this isn't always true (see MacOS X, for instance), but it's the norm in Linux.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25
    Quote Originally Posted by Roxoff View Post
    At its most fundamental, the difference is that .bash_profile is executed when you log in at the terminal prompt, and .bashrc when you start an X session. For some *nix derivatives this isn't always true (see MacOS X, for instance), but it's the norm in Linux.
    When I log in at a terminal session, (that is, I'm using a program called putty.exe to sign into the Linux machine), is that considered an X session? Because the export definitions are all available to me in the terminal window.

Posting Permissions

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