Skip to content

Instantly share code, notes, and snippets.

@glidenote
Created February 26, 2013 08:31
Show Gist options
  • Save glidenote/5036988 to your computer and use it in GitHub Desktop.
Save glidenote/5036988 to your computer and use it in GitHub Desktop.
# open current directory in Finder
alias f='open .'
# cd to the path of the front Finder window
cdf() {
target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'`
if [ "$target" != "" ]; then
cd "$target"; pwd
else
echo 'No Finder window found' >&2
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment