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?

1 Answer 1


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.
  • 1
    help.ubuntu.com/community/EnvironmentVariables This link says profile.d should also be loaded with new shell login.
    – Swapniel
    Dec 30, 2015 at 9:35
  • At 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."
    – Thagomizer
    Feb 9, 2021 at 1:36

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.