Open a terminal tab at a specified directory from command line

command lineterminal

I am looking for a script-based solution executed in the command line.

Open a new window of terminal at specified ~/desktop

open -na terminal ~/desktop

Open a terminal tab

osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'

How to open a terminal tab at a particular dir.

Best Answer

In MacOS 10.13.2 (but possibly/probably in earlier versions too):

    directory=~/Downloads; osascript -e "tell app \"terminal\" to do script \"cd $directory\""