Skip to content

Instantly share code, notes, and snippets.

@kch
Created May 7, 2010 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kch/393370 to your computer and use it in GitHub Desktop.
Save kch/393370 to your computer and use it in GitHub Desktop.
make each new terminal tab open in the last dir you cd'd to. put this in your .bashrc
lastdir_store="$HOME/.last_cd_path"
function cd () {
builtin cd "$@"
exitcode=$?
pwd > "$lastdir_store"
return $exitcode
}
[ -f "$lastdir_store" ] && target=`cat "$lastdir_store"`
builtin cd "$target" 2>/dev/null || builtin cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment