Looking at my ~/.bashrc
I can see ls
is already defined as alias ls='ls --color=auto'
.
Adding a new ls
alias definition to /etc/bash.bashrc
as alias ls='ls -CF'
doesn't help because, I assume, the definition in ~/.bashrc
is overriding.
In my testing, commenting out the ls
alias defined in my ~/.bashrc
enabled to one I added for global definition in etc/bash.bashrc
to work.
This is quite a bit different to how Red Hat handles global aliasing, which enables you to put your global aliases in /etc/profile.d/[filename].sh
but due to the different way Debian and Red Hat are configured and the relationship between the profile and bashrc files, this doesn't seem to be an option for Debian.
By that, I mean for Red Hat it handles profile/bashrc files by sourcing them so they work for various shells/login types (as explained here https://unix.stackexchange.com/questions/170493/login-non-login-and-interactive-non-interactive-shells). However, for Debian it seems the files /etc/profile.d/*.sh
are only sourced for login shells. But as my previous answer here was deleted, I was unable to edit and clarify.
For Debian, if you are happy for global aliases to work only for login shells then put them in, say, /etc/profile.d/aliases.sh
. Otherwise, it looks like you need to add them to /etc/bash.bashrc
. Bearing in mind that aliases in ~/.bashrc
will take precedence. If aliases you define don't work, then chances are they are defined elsewhere and are overriding yours.