Find the answer to your Linux question:
Results 1 to 5 of 5
I am using Mandriva 2009.1 and my kernel version is 2.6.29.6-desktop586-1mnb I'm reading a couple of tutorial books to help advance my Linux skills. Now, the books keep mentioning the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie Max2009's Avatar
    Join Date
    Nov 2008
    Posts
    197

    .bashrc .bash_profile


    I am using Mandriva 2009.1 and my kernel version is 2.6.29.6-desktop586-1mnb
    I'm reading a couple of tutorial books to help advance my Linux skills.
    Now, the books keep mentioning the .profile file in the Home folder and /etc/profile.
    I found /etc/profile but can't find .profile. The only likely files I can find in the home directory are .bashrc and .bash_profile. Which does what? and which is instead of .profile?
    Cogito ergo surf - I think therefore I network.

    Registered Linux user #481826 Get counted!

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    476
    "When bash is invoked as an interactive login shell, or as a non-interac‐
    tive shell with the --login option, it first reads and executes commands
    from the file /etc/profile, if that file exists. After reading that file,
    it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that
    order, and reads and executes commands from the first one that exists and
    is readable. The --noprofile option may be used when the shell is started
    to inhibit this behavior."

    from "man bash"

    > which is instead of .profile?

    .bash_profile
    the sun is new every day (heraclitus)

  3. #3
    Linux Newbie Max2009's Avatar
    Join Date
    Nov 2008
    Posts
    197
    OK, so what does .bashrc do? Because I have this line in .bash_profile:
    Code:
    if [ -f ~/.bashrc ]; then
    	. ~/.bashrc
    fi
    Cogito ergo surf - I think therefore I network.

    Registered Linux user #481826 Get counted!

  4. #4
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Check if .bashrc file exists in your home folder.
    Code:
    cat .bashrc
    Post its contents here.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  5. #5
    Linux Newbie Max2009's Avatar
    Join Date
    Nov 2008
    Posts
    197
    I know it exists, I've edited it before.

    Code:
    # .bashrc
    
    # User specific aliases and functions
    
    # Source global definitions
    if [ -f /etc/bashrc ]; then
    	. /etc/bashrc
    fi
    
    #Fortune
    if [ -x /usr/games/fortune ]; then
        /usr/games/fortune -s 
    fi
    
    #Sets the CapsLock key so that it acts like a backspace
    setxkbmap -option caps:backspace
    I don't know why it's looking for /etc/bashrc, should I post the contents of that too? As far as I can tell all it does is to check if this is an interactive shell.
    Cogito ergo surf - I think therefore I network.

    Registered Linux user #481826 Get counted!

Posting Permissions

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