Open Terminal Tab in the same Directory in OSX

Thu, Nov 17, 2011 One-minute read

I tend to work with multiple tabs in my terminals, keep opening, closing them, and so it is very useful to me to open a new terminal in my current folder instead of going to the home.

I’ve found this nice script that will do the work for you:

<strong>#!/bin/bash<br /> osascript -e 'tell application "Terminal"' \<br /> -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \<br /> -e "do script with command \"cd `pwd`;clear\" in selected tab of the front window" \<br /> -e 'end tell' &#038;> /dev/null</strong>

If you c&p this in a new file called “nt” in your /usr/local/bin, and you change it’s permissions to be executable ( chmod +x /usr/local/bin/nt ), all you have to do to open a new tab in your current directory will be:

$> nt

Nice!