Skip to content

Instantly share code, notes, and snippets.

@jnunemaker
Created June 5, 2009 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jnunemaker/124402 to your computer and use it in GitHub Desktop.
Save jnunemaker/124402 to your computer and use it in GitHub Desktop.
How to open a clone of the current tab in terminal with a simple command
1) Put terminal_clone_tab.sh somewhere in
your path and make sure it is executable
chmod u+x terminal_clone_tab.sh
2) Then add the following alias (~/.bash_profile or something)
alias nt='terminal_clone_tab.sh'
3) Then you can hit nt (for new tab) anywhere
and a new tab will open up in same directory.
If there is an easier way to do this, let me know nunemaker@gmail.com.
#!/bin/sh
osascript <<-eof
tell application "Terminal"
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script with command "cd `pwd`; clear" in selected tab of the front window
end tell
eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment