/etc/profile.d scripts apparently aren't executed at login
6,552
What you are missing?
The files from /etc/profile.d
directory are sourced at startup, not when the application (in your case another terminal) starts. So, probably after a system restart your alias will work.
But, the right way to create aliases is:
- if you want to create system wide aliases, these should go in
/etc/bashrc
file - if you want to create personal aliases, these should go into your
~/.bashrc
file, or better into~/bash_aliases
file.
Related videos on Youtube
Author by
Tampa
Updated on September 18, 2022Comments
-
Tampa over 1 year
Does
/etc/profile.d
work or not?I create a file
rexster-console.sh
in/etc/profile.d
:alias rexster="/var/rexster-console-2.4.0/bin/rexster-console.sh" -rwxr-xr-x 1 root root 66 Feb 15 13:05 rexster-console.sh
I even run
sh rexster-console.sh
.I open up another terminal:
root@ubuntu:/etc/profile.d# rexster rexster: command not found
So, what am I missing?
-
Swapniel over 8 yearshelp.ubuntu.com/community/EnvironmentVariables This link says profile.d should also be loaded with new shell login.
-
Thagomizer about 3 yearsAt least on RHEL 7, a comment in /etc/bashrc reads: "# It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates."