tmux发送到某个会话指定命令/按键
发送指定按键到tmux的特定会话:
tmux send-keys [-t <session-name>] <key>
key
的取值参考tmux man手册:
When specifying keys, most represent themselves (for example 'A' to 'Z'). Ctrl keys may be prefixed with 'C-' or '^', and Alt (meta) with 'M-'. In addition, the following special key names are accepted: Up, Down, Left, Right, BSpace, BTab, DC (Delete), End, Enter, Escape, F1 to F20, Home, IC (Insert), NPage (Page Up), PPage (Page Down), Space, and Tab. Note that to bind the '"' or ''' keys, quotation marks are necessary
例如,向会话mc
发送指令ls
并按回车执行
tmux send-keys -t mc ls Enter
向会话mc
发送bash start.sh
并按回车执行
tmux send-keys -t mc bash Space start.sh Enter