0

Every time I reopen the MSYS console (not cmd.exe) I find that the aliases that I have added to the shell are cleared. How can I save my aliases so that I do not to reenter them on every use?

For example:

$ alias desktop="cd=C:/Users/Superuser/Desktop"
$ alias
clear='clsb'
desktop='cd=C:/Users/Superuser/Desktop'

Upon restarting:

$ alias
clear='clsb'

How can I preserve my aliases?

2 Answers 2

2

I don't know about the MSYS console, but doing the following works in minTTy.

Open your ~/.bash_profile (or ~/.profile) file in a good text editor. Scroll to the bottom. After the line alias clear=clsb, add

source ~/.bash_aliases

This way, you get to keep your aliases in a separate file while still having them load every time you start your Console or terminal emulator.

1

Change to user directory:

cd ~

Append to .bash_profile (which will run upon every new bash session):

echo "alias desktop=\"cd=C:/Users/Superuser/Desktop\"" >> .bash_profile

Warning! Some versions of msys uses .profile for aliases.

You must log in to answer this question.

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