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'
You also need to type the above command or
source ~/.bash_profile
to get this to take effect.
This works from any directory, but requires that your login shell be bash
(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, cd
ing 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 work only when you're in your home directory to start with (cd
without arguments takes you there quickly; you can type both commands on the same line: cd && cd myProjectsDir
).
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 replacemyalias
with any custom command name you wish. – None – 2012-01-05T20:13:29.927Check out https://github.com/joelthelion/autojump/wiki, it might also work for you.
– Daniel Beck – 2012-01-05T20:18:36.593