I have a Mac at work and my coworker set up an alias for me so that when I type git-tf
at the command prompt it runs /opt/git-tf-2.0.1/git-tf. However I'm not sure how he did this. My $PATH variable does not include /opt/git-tf-2.0.1, nor can I find a script by the name git-tf in any of the directories listed in $PATH. The commands whereis git-tf
and which git-tf
have not been of any help either.
3 Answers
Aliases are simply mappings of one command to another. You can list them by typing alias
in terminal, and set them by typing alias name=value
(e.g., alias rm=rm-i
)
Your coworker likely added an alias command to one of the config files that are sourced when your terminal starts. I'd start by looking in ~/.profile, if it exists. Otherwise, you can probably do a search for the alias command in question to find the file.
Other config file locations, as listed by sixtyfootersdude:
- /etc/profile
- ~/.bash_profile or ~/.bash_login or ~/.profile
- ~/.bash_logout
- ~/.bashrc
For more info on aliases, type man alias
.
-
1I forgot about
alias
. Thanks! And thanks for the location of config file locations. I feel like such a newb for even having to ask this question. Apr 8, 2013 at 23:19
look in your .bash_profile
or .profile
files.
You can try searching for the aliases thus-:
cd $HOME
grep alias *
-
.bash_profile is just what I was looking for! Thanks!
grep alias *
didn't work for me though. :-( Apr 8, 2013 at 23:18
You have to modify/create a .bashrc
file into your home directory, and inside that file you must insert:
PATH=/opt/git-tf-2.0.1/:$PATH
That line will cause you append the desired directory in your current path
after you must exec source .bashrc
from a console
Finally try exec:
git-tf