Linux/tmux: Difference between revisions

From Wiki
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Shortcuts ==
== Shortcuts ==
<pre>
<pre>
* CTRL-b + "         Split current pane vertically into two panes
CTRL-b + d         detach
* CTRL-b + %        Split current pane horizontally into two panes


* CTRL-b + d         detach
Windows(=Tabs)
CTRL-b + c         create window
CTRL-b + w        list windows
CTRL-b + n        next window
CTRL-b + p        previous window
CTRL-b + &        kill window
 
Panes(=Splits)
CTRL-b + %        vertical split
CTRL-b + "        horizontal split
 
CTRL-b + o        switch panes
CTRL-b + q        show pane numbers
CTRL-b + x        kill pane
</pre>
</pre>


== Reattach ==
== Reattach ==
Line 17: Line 28:
tmux attach -t test
tmux attach -t test
</pre>
</pre>


== Other ==
== Other ==
Line 27: Line 37:
<pre>
<pre>
set -g mouse on
set -g mouse on
set -g prefix2 C-a    # also allow CTRL-a as trigger combination
</pre>
== Scripting ==
* mux.sh
<pre>
#!/bin/sh
tmux new-session -d -s cluster
tmux send-keys -t cluster "ssh vm-docker0" ENTER "sudo bash" ENTER "watch docker ps" ENTER
tmux split-window -v -p 66
tmux send-keys -t cluster "ssh vm-docker1" ENTER "sudo bash" ENTER "watch docker ps" ENTER
tmux split-window -v -p 50
tmux send-keys -t cluster "ssh vm-docker2" ENTER "sudo bash" ENTER "watch docker ps" ENTER
tmux attach-session -d
</pre>
</pre>


== Links ==
* https://gist.github.com/MohamedAlaa/2961058


[[Category:Linux/CL-Tools]]
[[Category:Linux/CL-Tools]]
[[Category:Linux]]
[[Category:Linux]]
__NOTOC__

Latest revision as of 17:47, 23 December 2021

Shortcuts

CTRL-b + d         detach

Windows(=Tabs)
CTRL-b + c         create window
CTRL-b + w         list windows
CTRL-b + n         next window
CTRL-b + p         previous window
CTRL-b + &         kill window

Panes(=Splits)
CTRL-b + %         vertical split
CTRL-b + "         horizontal split

CTRL-b + o         switch panes
CTRL-b + q         show pane numbers
CTRL-b + x         kill pane

Reattach

tmux a

tmux ls

tmux attach -t 0
tmux attach -t test

Other

tmux kill-session -t test

.tmux.conf

set -g mouse on
set -g prefix2 C-a    # also allow CTRL-a as trigger combination

Scripting

  • mux.sh
#!/bin/sh

tmux new-session -d -s cluster
tmux send-keys -t cluster "ssh vm-docker0" ENTER "sudo bash" ENTER "watch docker ps" ENTER

tmux split-window -v -p 66
tmux send-keys -t cluster "ssh vm-docker1" ENTER "sudo bash" ENTER "watch docker ps" ENTER

tmux split-window -v -p 50
tmux send-keys -t cluster "ssh vm-docker2" ENTER "sudo bash" ENTER "watch docker ps" ENTER

tmux attach-session -d


Links