Tmux – How to Force Resize Window in Tmux

tmux

I usually connect to remote linux servers from a specific windows server (W1). On the Windows side, I use putty and on the linux side, I start tmux.

Occasionally, I have to use a different windows server (W2) and connect to the same tmux sessions.

Problem: If I had set a size for the putty windows on W1, then I can not exceed this size on W2. When I maximise the putty window, the extra space is unusable, filled with ~ characters.

Is there a way to "force" resize on W2, even if that means W1 will show only partial output ? Or a way to make W1 get disconnected from tmux session ?

Best Answer

With tmux list-client, you can list all clients connected to tmux sessions. For instance:

$ tmux list-client
/dev/pts/6: 0 [25x80 xterm] (utf8)
/dev/pts/8: 0 [25x80 xterm] (utf8)

From this point, you can choose to detach a specified client, or all clients of a specified session. Say I want to detach everyone connected to session 0:

$ tmux detach-client -s 0

Then, you can attach the session so the size will be yours.

Actually, all that can be done with tmux attach -d (the -d option force all other clients to detach).

Related Question