0

When I type program A in the terminal, I end up getting program B. Where are the aliases or other file that controls which commands trigger program opening?

1
  • Type: which A. That will give you the full path to the program A. Find the program file and see whether it is actually a link to program B.
    – Jos
    Jun 23, 2014 at 14:18

2 Answers 2

0

Aliases to commands are stored in ~/.bashrc and /.bash_aliases. However, these may not always be the cause of the redirect. If the alias is not, then you can find out what path the terminal is following by typing type <command>. The type command will tell you where the file is that the terminal is executing and whether it is hashed to another executable elsewhere on the filesystem. In order to find out what file the link is to in that case, cd into that directory and type ls -l <file>.

0

type -a command_name might be a better way to CHECK,
which command_name will indeed tell you the path to something that is present on the disk.

Example:

$ type -a ls
ls is aliased to `ls --color=auto'
ls is a function
ls () 
{ 
    command ls --show-control-chars --color -G $*
}
ls is /bin/ls

$ command ls will on the other hand BYPASS the above and execute /bin/ls.

Hmm... I need to remove that alias.

$ unalias ls
$ cd
$ nano .bashrc
...
    # alias ls='ls --color=auto'
... [CTRL+X]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .