Terminal.app: open front-most Finder window
Add the following alias to your .bashrc:
cdf ()
{
currFolderPath=$(/usr/bin/osascript <<" EOT"
tell application "Finder"
try
set currFolder to (folder of the front window a$
on error
set currFolder to (path to desktop folder as al$
end try
POSIX path of currFolder
end tell
EOT
)
cd "$currFolderPath"
}