Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have give alias names in .bashrc file like below. But the alias names are not working. why?

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:.
share|improve this question
2  
Are you saying you get the environement variables but not the aliases, or you get none of it? –  Paul Jun 27 '12 at 4:54
    
May be a separate issue, but you wipe out your PATH. You should reference your old PATH in any setting, e.g. export PATH=$PATH:$ORACLE_HOME/bin:/usr/vac/bin:/usr/vacpp/bin:. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib –  Rich Homolka Jun 27 '12 at 15:38
add comment

3 Answers

This may happen because your PATH has not been set correctly to use all alias referenced binaries absoulte path. I.e ls exists under /bin/ls.

Can you give a try using "export PATH=$PATH:$ORACLE_HOME/bin:/usr/vac/bin:/usr/vacpp/bin:." or somthing like "export PATH=$ORACLE_HOME/bin:/usr/vac/bin:/usr/vacpp/bin:/bin:/sbin/:/usr/sbin

if not, then use "which" to find the path directory for individual alias ref binaries (which history).

share|improve this answer
add comment

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.

share|improve this answer
add comment

Questions to ask yourself are:

  • Is the ~/.bashrc already executed in your shell. It only runs when the shell is started. If you open a new shell (execute bash) it should be. With alias you should see all your aliases printed.
  • Second thing to ask: are the programs in your aliases available. At least h (alias history) should definitely work, because it is builtin.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.