Home > osx, programming > Open Terminal Tab in the same Directory in OSX

Open Terminal Tab in the same Directory in OSX

November 17th, 2011 Leave a comment Go to comments

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:

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

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!

  • Facebook
  • Twitter
  • Google Plus
  • Meneame
  • Add to favorites
  • RSS
  • BarraPunto
Categories: osx, programming Tags:
  1. No comments yet.
  1. No trackbacks yet.


five + 3 =