Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where all these aliases are stored?

Tags:

bash

macos

iterm

On my macbook when in iterm I run

alias

I can see a bunch of aliases, huge amount are for git, and mostly they are ok, but I'd like to change some.

I tried to add few to ~/.bash_profile:

alias gcm='git commit -m'
alias c='clear'

but it had no influence on the output of the alias.

Yes, I reloaded the iterm.

like image 624
Andrey Deineko Avatar asked Oct 21 '25 06:10

Andrey Deineko


2 Answers

"Where all these aliases are stored?"

~/.bashrc - this is a script invoked when you start your common terminal (iterm, etc.) because you invoke the non-login shell. The difference between login and non-login sheels is beautifully explained here: https://unix.stackexchange.com/a/46856/58326

Every script invoked from the other script can contain aliases as well.

So, I suggest you to add your aliases to the end of ~/.bashrc if you want to overwrite the aliases created in other scripts.

You can add your custom aliases wherever you want (e.g., als.sh) and load them only when you want: source als.sh

like image 197
John_West Avatar answered Oct 23 '25 22:10

John_West


Did you log out and log in again? I think ~/.bash_profile is the correct file, so it should work.

How to reload the bash aliases was answered before:

How to reload .bash_profile from the command line?

like image 42
oli-ver Avatar answered Oct 23 '25 22:10

oli-ver



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!