I’ve seen several web pages listing bash startup files in /etc and the home directory, each missing files that are mentioned elsewhere, e.g., /etc/bash_bashrc. Is there a document that lists all of the startup files and explains thir relations to each other? In particular, which profile should I use for system-wide environment variables and which for a specific user’s environment variables? Thanks.
I doubt that there is anything like what you’re asking for…
I don’t usually see binaries (executables) in /etc, I usually see only configuration files which are used by binaries.
bashrc is typically modified with settings for the logged in User. There may be system-wide bashrc methods but I rarely see it.
System-wide environmental modifications are related to /etc/profile but if you open that file you’ll see a warning about making changes directly to that file, an upgrade or update will likely replace that file erasing your customizations. Instead, you’re supposed to place your customizations in an /etc/profile.local file or create a file to be placed in the directory /etc/profile.d/
Creating a file in /etc/profile.d/ to set variables is probably my best bet. What about the various files in the home directory, e.g., ~/bash_profile, ~/.bashrc? Again, some sources mention names missing from others. Where is the best place to set environment variables specific to one user?
Try the man page!
IMHO it does describe it in the section INVOCATION.
If you want to set variables for single users, do so in the .bashrc or .profile in the users home directory. For all users in /etc.
profile is for login shells, bashrc for non-login shells.
On servers I usually put such things in ~/.profile.
In particular, which profile should I use for system-wide environment variables and which for a specific user’s environment variables? Thanks.