Debian Admin - Your way to Debian World

April 16, 2007

Difference between .bash_profile and .bashrc Files

by @ 9:55 pm. Filed under General

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

One of the things you always have trouble remembering when working with linux is what is the correct “.profile” to edit when you want to automatically set environmental variables.

According to the bash man page, .bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.

when you login when using a console, either physically at the machine or using ssh, .bash_profile is executed.

However, if you launch a terminal within a windowing system such as GNOME,KDE, launch the Emacs *shell* mode, or execute /bin/bash from within another terminal then .bashrc is executed.

Most people edit the files so one calls the other anyway.

To do this you need to open .bash_profile and uncomment the following lines (under the comment # include .bashrc if it exists):

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

Now when we login to our machine from a console,.bashrc will get called.

Tags: ,

You may also be interested in...

2 Responses to “Difference between .bash_profile and .bashrc Files”

  1. anon Says:

    Is there a system wide .bashrc like file? For interactive logons /etc/profile is sourced, but for non interactive I would really like to have a system wide file for all users without having to resort to making a .bashrc file on . /etc/profile.

    Thanks

  2. beijing Says:

    yes there is /etc/bash.bashrc (in my Edgy at least).

Leave a Reply

Subscribe RSS Feed

subscribe to the Debian Admin RSS feed

Internal links:

Sponsors:



Categories:

Support Debian Admin

Amount $:
Website(Optional):

Sponsors:

Archives:

Related Links:


Favourite Sites:

Wordpress Collection
Windows Reference
Ubuntu Geek
DebianHelp
All About Debian Tutorials
Power Electrical
Check Your IP Here
Debian,Ubuntu News
DebCentral
Tuxmachines
Capnkirby
Libervis
Nuxifield
Linux Horizon
Linux Appfinder
Debuntu
GNU/Linux For Everyone
Free Penguin
DebianAdmin is not related to the Debian Project.
This site is copyright © 2006,2007 Debian Admin
All Trademarks are the property of their respective owners.
The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner.

DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. All use is completely at your own risk. Changes to the existing content and new additions are made to this website periodically, without notification.
Rodney's Kontera DynamiContext Plugin plugged in.