Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show pane in all windows in tmux

Tags:

tmux

I wonder if I can configure a pane in tmux to appear in all windows.

Any hints how to do that?

like image 979
Bastian Ballmann Avatar asked Jan 12 '12 15:01

Bastian Ballmann


People also ask

How do I open the pane in tmux?

Switching between panes To get from one pane to another, press Ctrl+B followed by O (as in other).

How do I list windows in tmux?

As with many other Tmux commands, list-sessions has a shortcut, tmux ls, that displays the same information. To enter command mode, type prefix>: followed by list-sessions or ls to view a list of currently active Tmux sessions. By default, list-sessions are bound to the prefix> s key combination.

How do I move a pane from one window to another in tmux?

By default, Ctrl + b , ! would break the active pane into a new window and switch to it. Where Ctrl + b is the default prefix for tmux.


2 Answers

Of course this is possible, but you would need to run tmux inside a tmux pane.

+-------------+-------------+
| tmux pane 1 | tmux pane 2 |
|             |             |
|             |+-----------+|
|             || new tmux  ||
|             ||  session  ||
|             |+-----------+|
+-------------+-------------+

How to do it:

  1. start new tmux session
  2. split pane
  3. unset TMUX in pane 2 # this allows tmux in tmux
  4. start new tmux session in pane
  5. repeat 1-3
  6. run tmux attach -t <target-session> # this is opens the shared session

This does not work as easily if you are running wrappers for tmux, such as come with oh-my-zsh or tmuxinator. And there are probably many reasons you shouldn't do it, I just don't know any of them.

like image 123
Daniël W. Crompton Avatar answered Sep 18 '22 05:09

Daniël W. Crompton


Here's a way to do this, but the mirrored panes will be read-only. There's the pipe-pane command which sends the pane's output to a command. You can have that command write the output to a file and then from the panes you want to mirror from, you can tail -f that file. Example:

# In source pane
tmux pipe-pane 'cat > /tmp/asdf'

# In the target pane (or another tmux session or terminal window)
tail -f /tmp/asdf
like image 44
Konstantinos Bairaktaris Avatar answered Sep 19 '22 05:09

Konstantinos Bairaktaris