Tmux

git clone https://github.com/tmux-plugins/tmux-logging.git

Commandes line

tmux new -s ma_session : Create new session.
tmux attach : Attach to the last used session.
tmux attach -t X : Attach to ymux sessions with X number.
tmux ls : List active tmux sessions.
tmux split-window -dh "!!" : Run command in separate panel.
tmux source-file ~/.tmux.conf : Reload config

Base Commandes with key-binding

C-b w : List sessions/panels.
C-b x : Close panel or session.

C-b d : Se dettacher de la Session tmux
C-b C-z : Hang Session
C-b $ : Rename Session

C-b c : Open new windows.
C-b n : Switch between window´s session.
C-b , : Rename windows.
C-b X : Choose windows with number X.
C-b t : Display time in windows.

C-b » : Split vertical in terminal -> Panel
C-b % : Split horizontal in terminal -> Panel
C-b o : Switch between panels.
C-b C-o : Change order in panels.
C-b Flêches : Move between panels.
C-b espace : Switch Layout.
C-b ! : Break panels into windows.
C-b z : Zoom on panel.
C-b & : Close all panels from a window.

C-b ? : See all “Bind-key”.

C-b [ : Scroll up/down (q or Enter to quit).

  • /!\ or add to your .tmux.conf this setting set -g mouse on.

Usefull Changes in your config

  • change key-binding C-b to C-q (closer on AZERTY or QWERTY).
  • vertical split with - instaed of ".
  • Add new shorcut :
    • C-b r : reload
    • C-b / : look for in man
    • C-b s : Sync between panels.

Command your Tmux

  • C-b : : Pass a command to Tmux.
  • setw synchronize-panes : (de-)acitvate sync between panels.
1# Put in your .tnux.conf - to Bind "l" open 4 SSH connexions and sync between panels 
2bind l new-window 'ssh server1' \; split-window 'ssh server2' \; split-window 'ssh server3' \; split-window 'ssh server4' \; rename-window LOGS \; select-layout tiled \; setw synchronize-panes

tmux source-file ~/.tmux.conf; : reload config

 1# Fonction Tmux, à mettre dans le .bashrc
 2function txh {
 3    tmux split-window -dh "$*"
 4}
 5function txv {
 6    tmux split-window -dv "$*"
 7}
 8#$ tmw watch uptime
 9#$ tmw htop
10#$ tmw rsync -arvz source::mnt/location /home/tom/destination
11
12if [ -z "$TMUX" ]; then
13    tmux attach -t default || tmux new -s default
14fi

My .Tmux.conf

 1set-option -g mouse on
 2
 3# List of plugins
 4set -g @plugin 'tmux-plugins/tmux-sensible'
 5set -g @plugin 'tmux-plugins/tmux-logging'
 6set -g @plugin 'dracula/tmux'
 7
 8# Config Dracula Theme
 9set -g @dracula-show-left-icon session
10set -g @dracula-plugins "git kubernetes-context cpu-usage ram-usage network-bandwidth"
11set -g @dracula-git-colors "green dark_gray"
12set -g @dracula-kubernetes-context-colors "cyan dark_gray"
13set -g @dracula-cpu-usage-colors "red dark_gray"
14set -g @dracula-ram-usage-colors "orange dark_gray"
15set -g @dracula-network-bandwidth-colors "yellow dark_gray"
16set -g @dracula-show-flags true
17set -g @dracula-show-empty-plugins false
18
19# switch panes using Alt-arrow without prefix
20bind -n M-Left select-pane -L
21bind -n M-Right select-pane -R
22bind -n M-Up select-pane -U
23bind -n M-Down select-pane -D
24
25# Set 256 colors
26set -s default-terminal 'tmux-256color'
27
28# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
29run -b ~/.tmux/plugins/tpm/tpm