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?
2 Answers
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>
.
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]
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.