If I have a tmux
session called "Test", and inside "Test" I have two windows "Test1" and "Test2", how do I send a command to "Test2"?
tmux send-keys -t Test.Test2 "STUFF HERE"
won't work. That syntax is for panes only.
Unbelievable. I searched everywhere for an answer on the web and I could not find it. Apparently it is just:
tmux send-keys -t Test:Test1 "TEST" C-m
tmux send-keys -t {session}:{window}.{pane}
, so tmux send-keys -t Test:Test1.1 "TEST" C-m
would send that to the first pane.
Jul 9, 2020 at 4:48
tmux send-keys -t ':.!'
to mean "last active session (i.e. the current one), last active window, previously selected pane."
Nov 1, 2022 at 22:05
echo $TMUX_PANE
inside the target pane. This will output e.g. %1
. With information, you can send keys from anywhere (not necessarily from within tmux) with e.g the following command: tmux send-keys -t %1 "whoami" C-m