Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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

share|improve this answer
up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.