Timeline for Setting PATH variable in /etc/environment vs .profile
Current License: CC BY-SA 4.0
24 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 24, 2024 at 19:41 | comment | added | Byte Commander♦ | @cueedee I'm not fully sure, but I believe those other files you mention are read by PAM during the login of a user, not by any mechanism included in plain Bash. Can't tell you which order exactly though. To search references to those files, I tried reading through e.g. grep -sRF /etc/default/locale /etc. | |
| Jan 24, 2024 at 8:01 | comment | added | cueedee | @ByteCommander, while that link covers a great deal of the invocation sequence for a bash shell, it has no mention of where the evaluation of the (shell-agnostic) /etc/environment and /etc/default/locale fit in, or in what order. | |
| Jan 22, 2024 at 18:10 | comment | added | Byte Commander♦ | @cueedee manpages.ubuntu.com/manpages/focal/en/man1/… The INVOCATION section of the Bash manpage describes exactly which file is read when and under what conditions. Generally /etc before the equivalent user files. *.d/ files are usually sourced explicitly from their respective base file and not by Bash directly. Whether bashrc and profile are read at all depends on whether Bash is invoked as interactive and/or login shell or not. | |
| Jan 21, 2024 at 10:59 | comment | added | cueedee | Any thoughts on how the files in /etc/default/* factor in? The order of processing of all these ('etc/environment, /etc/default/*, /etc/profile, etc/profile.d/*`) is one aspect I'm interested in. | |
| Nov 4, 2019 at 8:14 | comment | added | Marc | Could you elaborate on why you wouldn't edit and extend /etc/environment? It seems made for the job... | |
| S Nov 1, 2019 at 19:46 | history | suggested | AlbertB | CC BY-SA 4.0 | further info on how user's local bin directories are added to PATH on 18.04 |
| Nov 1, 2019 at 17:45 | review | Suggested edits | |||
| S Nov 1, 2019 at 19:46 | |||||
| Jun 11, 2019 at 14:53 | comment | added | Tim M. | "So if you use the default Bash shell, you should make sure that you don't have a ~/.bash_profile or ~/.bash_login if you want the changes in ~/.profile to have an effect for your user." - I'd argue that probably a better solution that deleting .bash_profile and .bash_login is to make use of those instead of .profile. | |
| Jul 18, 2018 at 4:15 | comment | added | KCD | Beware not everything is an interactive shell so some things will not load any .profile or .bashrc e.g stackoverflow.com/a/18665363/516748 | |
| S Apr 7, 2018 at 17:11 | history | suggested | CommunityBot | CC BY-SA 3.0 | Improving the answer with a link |
| Apr 7, 2018 at 16:04 | review | Suggested edits | |||
| S Apr 7, 2018 at 17:11 | |||||
| Nov 15, 2017 at 1:03 | comment | added | Hawkeye Parker | "...executed as regular shell scripts by all shells during their initialization." I think this is misleading. Might suggest (to some) that simply opening a non-login terminal shell from the GUI desktop will execute /etc/profile, which it won't. askubuntu.com/questions/155865/… | |
| Apr 13, 2017 at 12:25 | history | edited | CommunityBot | replaced http://askubuntu.com/ with https://askubuntu.com/ | |
| Jan 13, 2017 at 2:17 | audit | Low quality posts | |||
| Jan 13, 2017 at 2:19 | |||||
| Dec 30, 2016 at 19:22 | history | edited | Byte Commander♦ | CC BY-SA 3.0 | added 82 characters in body |
| Dec 30, 2016 at 18:40 | comment | added | Eliah Kagan | @GunnarHjalmarsson Thanks for the info -- until about five minutes ago, I thought the default ~/.profile still had this too, but you're right -- /etc/skel/.profile doesn't have it on my upgraded 16.04 system (and a user account created when installing 16.04 on another machine doesn't have it in their .profile). | |
| Dec 30, 2016 at 15:19 | vote | accept | pkaramol | ||
| Dec 30, 2016 at 15:12 | comment | added | Gunnar Hjalmarsson | /etc/skel/.profile in 16.04 has the line I mentioned. You apparently created your user in a previous release. | |
| Dec 30, 2016 at 14:57 | comment | added | Byte Commander♦ | @GunnarHjalmarsson Define "nowadays", please? I'm running 16.04 and that's how it looks there. | |
| Dec 30, 2016 at 14:55 | comment | added | Gunnar Hjalmarsson | Nowadays ~/.profile does not check for the existence of ~/bin, but it simply has the line: PATH="$HOME/bin:$HOME/.local/bin:$PATH" | |
| Dec 30, 2016 at 14:40 | history | edited | Byte Commander♦ | CC BY-SA 3.0 | added 173 characters in body |
| Dec 30, 2016 at 14:30 | history | edited | Byte Commander♦ | CC BY-SA 3.0 | added 173 characters in body |
| Dec 30, 2016 at 14:23 | history | edited | edwinksl | CC BY-SA 3.0 | deleted 5 characters in body |
| Dec 30, 2016 at 14:10 | history | answered | Byte Commander♦ | CC BY-SA 3.0 |