Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

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