Results 1 to 3 of 3

Thread: Difference between .bashrc and .profile file?

  1. #1
    Join Date
    Aug 2009
    Beans
    178

    Red face Difference between .bashrc and .profile file?

    Hi,
    Please help to understand the following:

    Difference between .bashrc and .profile file?

    Thanks,

    Vivek

  2. #2
    Join Date
    Dec 2009
    Beans
    Hidden!

    Re: Difference between .bashrc and .profile file?

    bashrc determines the behavior of a shell while .profile holds the configuration of a shell's profile data

  3. #3
    Join Date
    Apr 2005
    Location
    Finland/UK
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Difference between .bashrc and .profile file?

    .bashrc is for Bash only, while .profile is used by other shells as well.

    Another important difference is that .profile is used at the time when you log in, be it on a terminal, or into your desktop. So settings in there will apply always when youa re logged in. Bashrc on the other hand is executed each time you open a Bash session, for example every time you open a terminal.

    Here's an example, I want to add ~/bin to my path, so that I can run programs in that directory without having to type the full apth to them. Since I want that to wosk all the time, even for desktop applications, I need to define that in the .profile file. (doing it in .-bashrc would work for terminal only)

    On the other hand I also want to get a fortune every time I open a terminal. So I need to add the comamnd into my .bashrc. (doing it in .profile wouldn't have any noticeable effect when using terminal emulators, since the file wold execute when I log into my desktop, not for each terminal I open).

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
  •