How to quickly send commands to nested tmux sessions?

I have the following in my .tmux.conf

set -g prefix M-j
bind-key j  send-prefix

I need to press (Atl+J) + (J) + bound-key to send something to the nested tmux session. I feel it is rather slow. Is there any better way? For example, I would love to be able to do (Alt+J) + (2x bound-key) to do stuff in the nested session. I constantly execute commands in the top tmux session instead of executing them in the nested one.
Also, how come everybody binds prefix to C-a? I find it awfully slow and unpleasant to type this combination. Am I missing something?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

It is one less keypress to send a command to your nested session if you choose a different key. I use Ctrlt for my standard prefix, and Ctrla for nested sessions.

# set prefix key to ctrl+t
unbind C-b
set -g prefix C-t

# send the prefix to client inside window
bind-key -n C-a send-prefix

Note that I use the -n switch. From the bind-key entry in man tmux:

if -n is specified, it is not necessary to use the prefix key, command is bound to key alone.

So, as an example, Ctrlt, c opens a new window in tmux; Ctrla, c does the same in the nested session.

Method 2

The reason for ctrl-a is that most Unix hackers (that I know at least) remap caps lock to control. That makes all ctrl- ops faster, especially ctrl-a.

Method 3

Alternatively you can disable controls of the outer tmux session. Most of the time I want to control the inner session, so I use F12 as toggle hotkey.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments