.profile does not get sourced upon login in Fedora
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.
Some distributions use .profile and some use .bashrc. I see that you have both. Maybe fedora is using .bashrc to configure bash at login. Also I would check out .bash_profile
What names the startup files have and in what order they are tried is something I have to look up every time I need it. Besides depending on the flavor of shell (Bash, Korn, Bourne, C etc) it can also depend on what you use the shell for. For example is this instance of the shell going to be your login shell? An interactive shell that is NOT the login shell? Just a shell script?
These different situations need (possibly) different things initialized. For example, if you just want to run a shell script as though it were any old unix command, defining functions and aliases is probably overkill. But if you are logging on (or off) you may want to do special things, perhaps for administrative reasons.
Also, these scripts can exist not only in your home directory, but also system-wide in /etc. I found it helpful to put lines like "echo 'this is /etc/bash_profile'" in each file so I know what ones are executed in which order under what circumstances.
Also, the various files can explicitly call ("source") each other, typically from inside an "if" statement that checks whether that file exists.
Some distributions use .profile and some use .bashrc.
Nope. (Reasons below).
Quote:
Originally Posted by bach-fiend
What names the startup files have and in what order they are tried is something I have to look up every time I need it. Besides depending on the flavor of shell (Bash, Korn, Bourne, C etc) it can also depend on what you use the shell for. For example is this instance of the shell going to be your login shell? An interactive shell that is NOT the login shell? Just a shell script?
Yes. Hence, to the original poster I say: read the man page for the shell you are using.
The initialization files do not depend on the distro, but in the shell you use and how you use it (login vs. non login, interactive or not, special parameters passed, etc.), hence. For bash, you should be looking at ~/.bashrc for interactive but non-login shell. If you really mean an interactive login shell then it will first source /etc/profile if it exists, and after that it will source one and only one of ~/.bash_profile, ~/.bash_login, and ~/.profile, only the first one will be used, even if it's empty, so, if ~/.bash_profile is there, ~/.profile will never be read by bash.
That and more is in the bash man page, so read it, specially the section titled "INVOCATION". Other shells will follow different rules, so if you don't use bash, read the man page for your shell.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.