4 ms·
This one is pretty useful! Open current OSX Finder directory in Terminal: cdf () { target=`osascript -e 'tell application "Finder" to if (count of F
by aliencat 8y ago
This one is pretty useful!
Open current OSX Finder directory in Terminal:
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
}
- erichurkman 8y agoAnd `open .` does the opposite: opens Finder to your current directory.
- esseti 8y agocan't you just wite "cd" and drag the folder into the terminal?
- yesenadam 8y agoYes, but that's a royal pain. 'cdf' are 3 adjacent keys.