Me and a friend of mine are working through RHCSA together and we stumbled on something neither of us fully understands. This is the way we think it works and are wondering if it's correct.

When you login with a text-based, interactive login, the shell obtains the settings from /etc/profile or ~/.bash_profile (.profile in Debian?). Here's where we get confused. Any subshell that spawns from that session has the same settings as the parent (IE: What it got from /etc/profile and ~/.bash_profile ? ) Or does it basically forget all those settings and only inherit from /etc/bashrc and ~/.bashrc?


when you login via X Windows is that a shell?

Is it just a session manager with its own special settings? Or does it also inherit from /etc/profile?

If I open a GUI application within X windows, where is it inheriting permissions from?

1 Answer 1


I believe this question might help understand a bit: Difference between Login Shell and Non-Login Shell?

I'll just answer from my experience. If you use an interactive login shell, like bash, it will read/source ~/.bash_profile once you login. Any new sub-shell you open within that session will inherit these settings, and in addition source ~/.bashrc. That is why in general, people put their environment variables in .bash_profile, and other things like aliases or the prompt theme into .bashrc.

If you however use a display manager to login, eg. lightdm, it doesn't source .bash_profile once you login. Instead, it usually reads ~/.xprofile, and any terminal you start will then only source ~/.bashrc (~/.bash_profile is never sourced in this case)

Some people create a ~/.profile or ~/.env file with all environment variables and global settings, and source that from ~/.bash_profile, ~/.xprofile, ~/.zprofile, etc., to make switching between login shells or display manager easier. Then you could still put shell/x specific things in their respective files. For example my ~/.xprofile is simply

source ~/.env
volumeicon &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.