why alias names defined in .bashrc file are not working?
Did you source your .bashrc
file after you changed it? Try:
. ~/.bashrc
Then your shell should see the changes. Alternatively, you can terminate and restart your shell.
p.s.
When you run from a script, load this first ref
shopt -s expand_aliases
Maybe you are trying to define your aliases in your .bashrc
that are already global.
Usually your aliases in .bashrc
are defined before the /etc/bashrc
call.
Try to define them after.
Here an example of your .bashrc
:
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
alias c='clear'
alias l='ls -lt'
alias h='history'
alias d='ls -lt |grep "^d"'
export ORACLE_HOME=/ora11gr2/app/oracle/product/11.2.0/db2
export ORACLE_LIB=/ora11gr2/app/oracle/product/11.2.0/db2/lib
export PATH=$ORACLE_HOME/bin:/usr/vac/bin:/usr/vacpp/bin:.
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:.
Just in case any MacOS users come looking for this answer, I tried this on my MacBook and even restarting the Terminal would not load the new alias definitions. The only way I could get it to work was to source ~/.bashrc
every time. I then tried moving my alias definitions to ~/.bash_profile
and this is what did the trick.