News for hackers. Stuff that matters.
Re:Ask HN: Best things in your bash_profile/aliases? by aliencat on Sunday January 13, 2019 @04:23PM (#18898780)
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
}
Re:Ask HN: Best things in your bash_profile/aliases? by erichurkman on Sunday January 13, 2019 @04:33PM (#18898840)
And `open .` does the opposite: opens Finder to your current directory.
Re:Ask HN: Best things in your bash_profile/aliases? by esseti on Monday January 14, 2019 @03:55AM (#18901650)
can't you just wite "cd" and drag the folder into the terminal?
Re:Ask HN: Best things in your bash_profile/aliases? by yesenadam on Monday January 14, 2019 @02:38PM (#18905748)
Yes, but that's a royal pain. 'cdf' are 3 adjacent keys.