Pages

Thursday 27 February 2020

How to send command to specific pane in tmux

I was looking for a way of launching process in tmux split screen mode where one part of the terminal shows log entries and another starting sequence. I found a script in internet but was having problems locating a pane. So first I had to figure out correct pane locations. To do this execute following command:


tmux list-panes –a

This gave me indication that window id is equal 1 and not 0 as indicated in tmux status bar.

Then it went easy, just go with following bash script:

#!/bin/bash
session="my name"
window=${session}:1
pane=${window}.1
echo $pane
tmux send-keys -t "$pane" C-z 'test cmd 1' Enter
tmux send-keys -t "$pane" 'test cmd 2' Enter

No comments:

Post a Comment