Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
can anyone tell me the difference between /etc/profile and /etc/bashrc ? from what i understand they both set system wide confgurations, so i cant understand the why both of them are there.
on another note, i feel like im being called to the other side. the more im learning about linux the more it intrigues me. i think the simplicity of windows is starting to get to me. ive installed mepis (which i love btw), and its given me the best of both worlds. im kinda starting to see *nix nerds like it so much. if anyone has any newb friendly links please let me know.
Originally posted by maybbach can anyone tell me the difference between /etc/profile and /etc/bashrc ? from what i understand they both set system wide confgurations, so i cant understand the why both of them are there.
Hmm. I don't think /etc/bashrc exists. I do believe you might be confusing that with your user profile, ~/.bashrc. /etc/profile sets system wide parameters for all users while ~/.bashrc just for the user.
Granted, I may be wrong since we run different distros.
Originally posted by maybbach can anyone tell me the difference between /etc/profile and /etc/bashrc ? from what i understand they both set system wide confgurations, so i cant understand the why both of them are there.
on another note, i feel like im being called to the other side. the more im learning about linux the more it intrigues me. i think the simplicity of windows is starting to get to me. ive installed mepis (which i love btw), and its given me the best of both worlds. im kinda starting to see *nix nerds like it so much. if anyone has any newb friendly links please let me know.
anyways thanks in advance.
There is no such thing as /etc/bashrc
I'm using debian sarge and don't see it. Maybe it's for some older proggy?
Don't return to M$ Toy with different distro's. I've tried SuSE, Slackware, Debian, Mandrake, Fedora and i've only been using linux for less than a year. In the end you'll find the distro u like best.
The /etc/bashrc file is a common practice, but not directly supported by bash.
Typically, a user's ~/.bashrc will check to see if /etc/bashrc exists, and then sources it if it does. Like /etc/profile, it's intended to provide some basic, global settings for a user to start with. However, the user can completely disregard it if (s)he so desires.
The difference between them that maybbach was getting at is a subtle difference in how a shell is started. Depending on the arguments a shell receives when started, it will load /etc/profile, ~/.bash_profile, and ~/.bashrc. Other times, it only loads ~/.bashrc. To get all the gory details on what modes cause which files to be read, open up the bash man page, and scroll down to the "INVOCATION" section.
Last edited by Dark_Helmet; 04-21-2005 at 05:15 PM.
as i understand it, .bashrc (whether the user's copy or the system-wide one) is used for login shells, and the profile is used for non-login shells. so using su will load settings from profile, and su - will load them from bashrc. i think.
Originally posted by mcd as i understand it, .bashrc (whether the user's copy or the system-wide one) is used for login shells, and the profile is used for non-login shells. so using su will load settings from profile, and su - will load them from bashrc. i think.
mdc has spoken the best but just has it backwards
profile is interactive login
bashrc is interactive non-login
the lines get all blurred if for instance in you ~/.bash_profile you put
if [ -f "$HOME/.bashrc" ] ; then
source $HOME/.bashrc
fi
and/or the other way around
i think /etc/bashrc is kind of important if for no other reason than to provide a different prompt for non-logins -- i use ~/.bashrc to load root only aliases for su with
if [ `whoami` = "root" ]; then
and in that instance ~/.bash_profile handles the prompt the same way
the party line is aliases and functions go in bashrc
environment variables go in profile
but rules are made to be broken
basically you just make these files do whatever you want them to do
there is another one too ~/.bash_logout to do junk on logout
Originally posted by ultramancool There is no such thing as /etc/bashrc
I'm using debian sarge and don't see it. Maybe it's for some older proggy?
Don't return to M$ Toy with different distro's. I've tried SuSE, Slackware, Debian, Mandrake, Fedora and i've only been using linux for less than a year. In the end you'll find the distro u like best.
i dont think linux has enough of what i want to switch totally. theres still a lot of problems that need to be fixed b4 it can get to ms's level imo. xp set a new standard for ms products, so for me to switch, linux has to be a whole lot better. (i can feel the flames coming already).
back on topic tho, if i put whatever global settings in /etc/profile and user settings in ~/.bashrc, i should be ok right. i can just leave /etc/bashrc and ~/.bash_profile alone and the changes should work....right?
thanks for all the explanations, it really cleared things up.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.