Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Is there any way to detect how many levels of tmux I'm currently in? I've been able to hack it with 2 levels by simply checking [[ -n "$SSH_CLIENT" && -n "$TMUX" ]], so I can have one level on the client and one on the server. I use that check to setup a different prefix (ctrl-a, ctrl-b).

But now I'm finding I want to ssh from inside the server shell, so would like even a third level, thus requiring a third prefix combination to be setup.

Obligatory Inception meme

share|improve this question
In researching this I found no methods that would allow you to do this. So you're likely going to have to hack something together. – slm Feb 23 '14 at 1:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.