Warp icon indicating copy to clipboard operation
Warp copied to clipboard

Ability to open and new tab and execute a command in the tab from the command line

Open tmccormi opened this issue 1 year ago • 11 comments

Discord username (optional)

No response

Describe the solution you'd like?

Would like to be able to launch the opening of several tabs with commands from the command line (like a bash script).

Example
open-all.sh
# Open all of my servers terminals via ssh

warp -tab-command "ssh [email protected]"
warp -tab-command "ssh [email protected]"
warp -tab-command "ssh [email protected]"

Is your feature request related to a problem? Please describe.

I need to be able to quickly open a set of servers in separate tabs to respond to an issue or do a task that requires multiple terminals in tabs or split screens opened quickly (via ssh or AWS ssm, for instance).

Additional context

I was able to configure my OS to open a shell script from the file browser using Warp, but not as Tabbed sessions, alos having to use to UI to click in each shell script was icky.

How important is this feature to you?

3

Warp Internal (ignore) - linear-label:770f6576-d6c0-4e4f-a259-fc64b5156087

None

tmccormi avatar Dec 13 '23 01:12 tmccormi

Hi @tmccormi The best feature for this use case may be Launch Configurations, you can configure a set of tabs to open and then run any commands in those tabs, including ssh. Please see an example of this in our docs. https://docs.warp.dev/features/sessions/launch-configurations#commands Then, to open Launch configurations with a script, please take a look at Warps URI scheme as there is one for opening them with warp://launch/<launch_configuration_path>. https://docs.warp.dev/features/uri-scheme

Hope this helps with your use case, if not, then let us know what we can do differently.

dannyneira avatar Dec 13 '23 16:12 dannyneira

Hey @tmccormi , I also have the same test case. In my case I created a launch configuration to ssh into the server. It works that's great. But I want to run commands on few of the server (on the servers after ssh) and not on my local machine. And in on of the tab after I ssh into a server, I want to ssh again to a different server from current one (SSH Tunneling) and execute some commands over there.

For example my launch configuration

name: Open Machines
windows:
  - tabs:
      - title: SSH Forward
        layout:
          cwd: /Users/vinit
          commands:
            - exec: ssh -i ~/mdoa [email protected]
            - exec: ssh -i "mdoa.pem" [email protected]
            - exec: sudo su
        color: blue
  - tabs:
      - title: SSH Forward
        layout:
          cwd: /Users/vinit
          commands:
            - exec: ssh -i ~/mdoa [email protected]
            - exec: ssh -i "mdoa.pem" [email protected]
            - exec: sudo su
        color: blue

vinit03 avatar Dec 21 '23 17:12 vinit03

I see, but I can't find anything that shows how you create these? There is "save new" in Launch Configs, but nothing about how to create it to begin with.

On Thu, Dec 21, 2023 at 9:30 AM Vinit Maniyar @.***> wrote:

Hey @tmccormi https://github.com/tmccormi , I also have the same test case. In my case I created a launch configuration to ssh into the server. It works that's great. But I want to run commands on few of the server (on the servers after ssh) and not on my local machine. And in on of the tab after I ssh into a server, I want to ssh again to a different server from current one (SSH Tunneling) and execute some commands over there.

For example my launch configuration

name: Open Machines windows:

  • tabs:
    • title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @.*** - exec: ssh -i "mdoa.pem" @.*** - exec: sudo su color: blue
  • tabs:
    • title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @.*** - exec: ssh -i "mdoa.pem" @.*** - exec: sudo su color: blue

— Reply to this email directly, view it on GitHub https://github.com/warpdotdev/Warp/issues/3959#issuecomment-1866687111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFZC34N5NB7JBFATDNLMDYKRW3PAVCNFSM6AAAAABASLN2LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWGY4DOMJRGE . You are receiving this because you were mentioned.Message ID: @.***>

tmccormi avatar Dec 22 '23 00:12 tmccormi

I see, but I can't find anything that shows how you create these? There is "save new" in Launch Configs, but nothing about how to create it to begin with. On Thu, Dec 21, 2023 at 9:30 AM Vinit Maniyar @.> wrote: Hey @tmccormi https://github.com/tmccormi , I also have the same test case. In my case I created a launch configuration to ssh into the server. It works that's great. But I want to run commands on few of the server (on the servers after ssh) and not on my local machine. And in on of the tab after I ssh into a server, I want to ssh again to a different server from current one (SSH Tunneling) and execute some commands over there. For example my launch configuration name: Open Machines windows: - tabs: - title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @. - exec: ssh -i "mdoa.pem" @.*** - exec: sudo su color: blue - tabs: - title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @.*** - exec: ssh -i "mdoa.pem" @.*** - exec: sudo su color: blue — Reply to this email directly, view it on GitHub <#3959 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFZC34N5NB7JBFATDNLMDYKRW3PAVCNFSM6AAAAABASLN2LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWGY4DOMJRGE . You are receiving this because you were mentioned.Message ID: @.***>

You need to create a file directly/manually. Warp will load it automatically. I'm using mac my save location is ~/.warp/launch_configurations/config.yaml

If a directory does not exists, create it. If a file does not exists, create it.

vinit03 avatar Dec 22 '23 11:12 vinit03

Ah, I see. Got it to work, thanks!

On Fri, Dec 22, 2023 at 3:36 AM Vinit Maniyar @.***> wrote:

I see, but I can't find anything that shows how you create these? There is "save new" in Launch Configs, but nothing about how to create it to begin with. … <#m_6077327715731205955_> On Thu, Dec 21, 2023 at 9:30 AM Vinit Maniyar @.> wrote: Hey @tmccormi https://github.com/tmccormi https://github.com/tmccormi https://github.com/tmccormi , I also have the same test case. In my case I created a launch configuration to ssh into the server. It works that's great. But I want to run commands on few of the server (on the servers after ssh) and not on my local machine. And in on of the tab after I ssh into a server, I want to ssh again to a different server from current one (SSH Tunneling) and execute some commands over there. For example my launch configuration name: Open Machines windows: - tabs: - title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @. - exec: ssh -i "mdoa.pem" @.*** - exec: sudo su color: blue - tabs: - title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @.***

  • exec: ssh -i "mdoa.pem" @.*** - exec: sudo su color: blue — Reply to this email directly, view it on GitHub <#3959 (comment) https://github.com/warpdotdev/Warp/issues/3959#issuecomment-1866687111>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFZC34N5NB7JBFATDNLMDYKRW3PAVCNFSM6AAAAABASLN2LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWGY4DOMJRGE . You are receiving this because you were mentioned.Message ID: @.***>

You need to create a file directly/manually. Warp will load it automatically. I'm using mac my save location is ~/.warp/launch_configurations/config.yaml

If a directory does not exists, create it. If a file does not exists, create it.

— Reply to this email directly, view it on GitHub https://github.com/warpdotdev/Warp/issues/3959#issuecomment-1867583012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFZC5NW3L7YAXHQLZ67FLYKVWETAVCNFSM6AAAAABASLN2LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRXGU4DGMBRGI . You are receiving this because you were mentioned.Message ID: @.***>

tmccormi avatar Dec 22 '23 13:12 tmccormi

The current solution is acceptable. It would be better if you put this solution to workflow section in Warp doc.

endersuu avatar Feb 27 '24 08:02 endersuu

related https://github.com/warpdotdev/Warp/issues/345 https://github.com/warpdotdev/Warp/discussions/612

Elijas avatar Mar 17 '24 04:03 Elijas

On MacOS, the open command works to run commands in new tabs:

open -a warp "/path/script.sh"
open -a warp "/bin/ls" --args "~/Downloads"

ghost avatar Apr 10 '24 14:04 ghost

On MacOS, the open command works to run commands in new tabs:

open -a warp "/path/script.sh"
open -a warp "/bin/ls" --args "~/Downloads"

Works!!

Elijas avatar Apr 10 '24 16:04 Elijas

Can I use open to run a zsh script? I tried like open -a warp "/bin/zsh" --args "-i -c test" But it's not working (opening a subshell)

gnegno84 avatar Aug 13 '24 11:08 gnegno84

Is there a solution to open many tabs, but all in a split view? Like a tab in right side and another in left side.

TeijiW avatar Aug 24 '24 23:08 TeijiW

On MacOS, the open command works to run commands in new tabs:

open -a warp "/bin/ls" --args "~/Downloads"

Works!!

Does it really? For me it brings up Warp and executes the command /bin/ls (without arguments) in the directory /bin. Could you please verify? I'm running Warp v0.2024.09.10.08.02.stable_01 on macOS Sonoma 14.6.1 (23G93).

jabbrahn avatar Sep 16 '24 10:09 jabbrahn

Is there any update on this? I also can't pass arguments. Thanks!

dngfra avatar Feb 21 '25 17:02 dngfra

I also wish there was a simple command for this like ttab, if there was, I'd use warp as years of aliases on my work machine use ttab for easier development

Frankie-HIL avatar Apr 08 '25 13:04 Frankie-HIL

Just wanted to add that this would be super cool! In my ideal world, I could open Warp and, in the sidebar or somewhere, have a Runbook or a Launch Config or something called SSH to Whatever which would launch two shells side by side and open an SSH connection in each. I had something similar in iTerm, I think it was called a profile or something like that.

mcblum avatar Apr 22 '25 13:04 mcblum

open -a warp "/path/script.sh"

thanks! that helped and I got it to this:

open -na warp "/Users/hmd/scripts/scratchpad2.sh"

my issue is how can I get it to close automatically after the script exits

eg with kitty I do this

kitty --title "vim-anywhere" -e sh -c '. $HOME/dotfiles/variables.sh; cd $HOME; /opt/homebrew/bin/nvim -c "0read !/usr/bin/pbpaste";'

for a vim based scratchpad and I'm trying to get something similar going in warp.

or say if I wanted to launch htop and have the terminal close when the process quits

hamidzr avatar Jul 04 '25 01:07 hamidzr

Leaving this for people with a similar use case to mine.

I wanted to open new Warp tabs in the Yazi file manager (hover a directory, hit a key, boom, new Warp tab at that directory). The solution was to add this to my yazi.toml. This is MacOS-specific; for other systems, you'd need to replace open with a different command.

[[opener.warp_tab]]
run = 'open "warp://action/new_tab?path=$0"'
desc = "Warp: new tab here"
for = "macos"
orphan = true

[[open.prepend_rules]]
mime = "inode/directory"
use = ["warp_tab", "open", "reveal"]

mitranim avatar Oct 05 '25 17:10 mitranim

Focus on this detail

https://http-refererflustered.github.io/marcos/