Stoyan Zhekov's THOUghts TRash.

OS X Tip: Opening a new terminal tab in the current location

mallipeddi:

This is extremely useful while programming. Your pwd is /really/long/path/to/some/folder and you want to open a new tab in the OS X Terminal and navigate to the same folder. You can automate this thanks to AppleScript.

Save the following script in a file named ~/scripts/newtab.scpt:


on run argv
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
tell application "Terminal" to do script "cd " & item 1 of argv in front window
end run

Then in your ~/.bashrc or ~/.bash_profile, add the following:


alias newtab='osascript ~/scripts/newtab.scpt `pwd`'

Credits: I found this solution here.

Comments (View)
blog comments powered by Disqus