create new tab from terminal session
The following is one of several ways to create a new terminal window from inside a terminal session
open -a Terminal ~
Is there a way to create a new tab from inside a terminal session?
The following is one of several ways to create a new terminal window from inside a terminal session
open -a Terminal ~
Is there a way to create a new tab from inside a terminal session?
You should be able to do this via osascript -e ‘...’ (aka AppleScript)
https://superuser.com/questions/466619/open-new-terminal-tab-and-execute-script
If this does not do it for you, Google “AppleScript Terminal new tab” and you will find other examples.
Note: if your goal is to start Terminal and have Terminal create a dozen tabs, the look at Terminal’s “Window Groups”.
You can create your tabs, then save them as a Terminal Window Group, and set a Terminal Preference that specifies you use your saved Window Group when Terminal starts. Or you can tell Terminal to use a specific Window Group at any time during a Terminal session.
If you create Terminal profiles with a command to execute when creating the Terminal window or tab, such ssh commands to remote systems, where the ssh command runs the GNU screen or tmux command to attach to an already running remote session, then you can start Terminal, have a Window Group run, and in moments you have all your tabs and/or windows created and any profile stored commands executed to attach to remote sessions.
I do this with 4 windows, about 35 tabs 8 macOS local, and the rest going to 8 different Linux, AIX or Solaris systems.
I can launch or quit Terminal to my hearts content, and have my Terminal environment re-established with very little pain. OK, doing the initial profile setup took time, and more than a few experiments, but once finished, it mad my work life easier.
Yea Terminal Window Groups!!!
You should be able to do this via osascript -e ‘...’ (aka AppleScript)
https://superuser.com/questions/466619/open-new-terminal-tab-and-execute-script
If this does not do it for you, Google “AppleScript Terminal new tab” and you will find other examples.
Note: if your goal is to start Terminal and have Terminal create a dozen tabs, the look at Terminal’s “Window Groups”.
You can create your tabs, then save them as a Terminal Window Group, and set a Terminal Preference that specifies you use your saved Window Group when Terminal starts. Or you can tell Terminal to use a specific Window Group at any time during a Terminal session.
If you create Terminal profiles with a command to execute when creating the Terminal window or tab, such ssh commands to remote systems, where the ssh command runs the GNU screen or tmux command to attach to an already running remote session, then you can start Terminal, have a Window Group run, and in moments you have all your tabs and/or windows created and any profile stored commands executed to attach to remote sessions.
I do this with 4 windows, about 35 tabs 8 macOS local, and the rest going to 8 different Linux, AIX or Solaris systems.
I can launch or quit Terminal to my hearts content, and have my Terminal environment re-established with very little pain. OK, doing the initial profile setup took time, and more than a few experiments, but once finished, it mad my work life easier.
Yea Terminal Window Groups!!!
That information is on the Terminal Shell menu. Use ⌘-T to insert a new tab using the same profile in the current Terminal window.
@BobHarris I had a tough time using appleScript. I got it to run sometimes but it failed other times when, for whatever reason System Events stoped running. Fortunately the page you pointed me to mentioned a shellscript called ttab which worked flawlessly after I rebooted mac os. Before the reboot it would create a new window rather than a new tab. It's so much simpler than messing around with AppleScript.
create new tab from terminal session