Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use internal variable in tmux send-keys command?

Is there any way can let me do things like bind-key b send-keys "stty cols #{pane_width} rows #{pane_height}"

  1. I use TMUX.
  2. I often need to use ssh to login to CentOS servers which has no resize command.
  3. I cannot install command in those servers.
  4. The server's stty cannot auto resize when I resize the pane of tmux or the window of terminal.

I am now using a complicated way to accomplish this.

I write a display commend in my .tmux.conf, bind-key b display -p "stty cols #{pane_width} rows #{pane_height}".

Then I can copy the display-message and paste it to the command line of ssh-server.

like image 230
ZHUZHU-3 Avatar asked Sep 03 '25 08:09

ZHUZHU-3


1 Answers

You can get the variables interpolated using run-shell, eg:

bind-key b run-shell 'tmux send-keys "stty cols #{pane_width} rows #{pane_height}" Enter'
like image 192
meuh Avatar answered Sep 05 '25 00:09

meuh