Skip to content

Instantly share code, notes, and snippets.

@bobthecow
Created June 21, 2010 23:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobthecow/447701 to your computer and use it in GitHub Desktop.
Save bobthecow/447701 to your computer and use it in GitHub Desktop.
Change directories really fast
#!/bin/bash
#
# Change directories really really fast
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.cdd.bash`) and source it in `.bashrc`
#
# Usage:
# `cd .....` is equivalent to `cd ../../../..`, i.e.:
# `cd ..` plus one extra dot for each parent directory you want to jump
cdd () {
cd "$(python -c "d='${1}'; print d if d.strip('.') else '.' + '/..' * (len(d) - 1) if d else '${HOME}'")"
}
alias 'cd'='cdd'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment