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.

What I'd like to be able to do is when I'm in Terminal is to type:

cd myFolderShortcut

And for it to go straight to a directory I have a set up with this alias. Is this possible?

I did do a google for it and Aliases may be what I want, but I couldn't get it to work.

share|improve this question
If what you want is a shorter command for cd'ing into a specific directory, all you need to do is add the following to your ~/.bashrc: alias myalias='cd /path/to/directory'. You can replace myalias with any custom command name you wish. –  user111228 Jan 5 '12 at 20:13
Check out github.com/joelthelion/autojump/wiki, it might also work for you. –  Daniel Beck Jan 5 '12 at 20:18

2 Answers 2

up vote 12 down vote accepted

You don't need a shortcut file or anything like that.

You can set up an alias in ~/.bash_profile by adding the following line, so you just need to type myFolderShortcut to go there (without cd):

alias myFolderShortcut='cd /Users/danielbeck/Documents'

This works from any directory, but requires the bash shell (which is OS X's default)

You can, of course, create symbolic links to other directories in your home directory. Then, when you open Terminal and are in your home directory, cding takes you to the linked directory.

ln -s /Users/danielbeck/Documents/Projects myProjectsDir

Then, type cd myProjectsDir and you're there (the displayed path contains myProjectsDir though, not Documents/Projects).

The symbolic link will show in Finder. To hide it, type chflags hidden myProjectsDir.

This will only work when you're in your home directory to start with (cd without arguments takes you there quickly).

share|improve this answer
cd as cd ~ is my favorite alias. –  Rob Jan 5 '12 at 20:29
@Rob It's not technically an alias. cd without argument just implies ~. I like cd - better, by the way. –  Daniel Beck Jan 5 '12 at 20:36
Hi, I could not get your technique to work. I wanted to created a shortcut to my solr directory. It currently lives in my: alias solr='cd /Applications/MAMP/htdocs/website/WhoAt/solr/whoat/' Perhaps my path isn't correct? –  Leon Gaban Jun 10 '13 at 19:41
@Leon Are you using the bash shell? –  Daniel Beck Jun 10 '13 at 20:45
I think I'm using default I think... –  Leon Gaban Jun 10 '13 at 22:35

I know this is old, but this might help someone.

After you follow @Daniel Beck's answer above, and add the alias to the bash_profile like he mentioned, you have to type the following in the terminal window:

source .bash_profile

This will make all your aliases work.

I've got this from this answer on stack overflow. It has worked for me. I hope it works for someone looking for this...

How Do I create a terminal shortcut to this path?

share|improve this answer

Your Answer


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.