Skip to content

Instantly share code, notes, and snippets.

@lazywalker
Created October 11, 2020 01:35
Show Gist options
  • Select an option

  • Save lazywalker/1e58103879c3933bd84a4caa0e4cb7fb to your computer and use it in GitHub Desktop.

Select an option

Save lazywalker/1e58103879c3933bd84a4caa0e4cb7fb to your computer and use it in GitHub Desktop.
tmux linked panes

Main idea:

we can't link-panes, but we can use tmux nested & linked-window to achieve our goal. Here is how.

Step 1

Create the session that will manage the linked panes

  • create new session named shared
$ tmux new -s shared
  • run waht you want, just for sure
$ top

Step 2

Create the session that will contain the linked-panes, this is your main session

  • create new session
$ tmux new -s main
  • split pane
Ctrl+b "
  • access first pane
Ctrl+b q 1
  • unset $TMUX so we can nest sessions
$ unset TMUX
  • create a new session within the current pane from now on Ctrl+b will access the parent not the nested session
$ tmux new
  • remove status bar from the nested session
$ tmux set status off
  • link window 1 of the nested session with window htop of the shared session, kill the existing pane to avoid conflict
$ tmux link-windows -s shared:0 -t 1 -k

That's it.

Attach to the shared session from another machine, at the same time.

tmux a -t shared

Cleanup

  • kill the nested linked-pane, for your main session
Ctrl+b x
y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment