Posts Installation guide of terminal multiplexer T-MUX
Post
Cancel

Installation guide of terminal multiplexer T-MUX

It is a T-mux user guide. T-mux and VIM works awesome for development.

Installation:

1
sudo apt install tmux

Open tmux and press Ctrl+b and Shift+I to activate plugins.

Configuration:

  1. Clone tpm that is Tmux package manager.
1
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
  1. Create .tmux.conf file in $HOME directory.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
set -g default-terminal "screen-256color"

# pane border
set -g pane-border-style fg='#6272a4'
set -g pane-active-border-style fg='#ff79c6'

# message text
set -g message-style bg='#44475a',fg='#8be9fd'

# Status Line
set -g status-style bg='#44475a',fg='#bd93f9'
set -g status-interval 1

# status left
# are we controlling tmux or the content of the panes?
set -g status-left '#[bg=#44475a]#[fg=#ffffff,bold]#{?client_prefix,#[bg=#44475a]#[fg=#aa0000],} ⌘  '

# are we zoomed into a pane?
set -ga status-left '#[bg=#44475a]#[fg=#008800]#{?window_zoomed_flag,⇯ ,  }'

# window status
set-window-option -g window-status-style fg='#bd93f9',bg=default
set-window-option -g window-status-current-style fg='#ff79c6',bg='#282a36'

set -g window-status-current-format "#[fg=#44475a]#[bg=#bd93f9]#[fg=#f8f8f2]#[bg=#bd93f9] #I #W #[fg=#bd93f9]#[bg=#44475a]"
set -g window-status-format "#[fg=#f8f8f2]#[bg=#44475a]#I #W #[fg=#44475a] "

# status right

set -g status-right-length 78

set -g status-right '#[fg=#2f96f7,bg=#44475a]#[fg=#ffffff,bg=#2f96f7] Dev '
set -ga status-right '#[fg=#ff79c6,bg=#2f96f7]#[fg=#44475a,bg=#ff79c6] #(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") '
set -ga status-right '#[fg=#008800,bg=#ff79c6]#[fg=#ffffff,bg=#008800] #(/opt/scripts/ram_info.sh) '
set -ga status-right '#[fg=#2f96f7,bg=#008800]#[fg=#ffffff,bg=#2f96f7] #(/opt/scripts/cpu_info.sh) '
set -ga status-right '#[fg=#4e4e4e,bg=#2f96f7]#[fg=#ff3602,bg=#4e4e4e] %a %I:%M:%S %p #[fg=#ff3602]%e %b %Y '

# Plugin manager
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

# Tmux session manager
set -g @continuum-restore 'on'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

run '~/.tmux/plugins/tpm/tpm'
  1. Copy scripts directory into /opt/ directory.
  2. Run this command to activate tmux config.
1
tmux source ~/.tmux.conf

Shell Command

  1. Create new session ->> tmux new -s <session-name>
  2. List session ->> tmux list-sessions
  3. Attach session ->> tmux attach-session -t <session-name>
  4. Detach session ->> Ctrl+b -> d

Short-cuts

  1. Ctrl+b ->> Activate keybinding
  2. Ctrl+b -> [ ->> Activate Scrolling
  3. Ctrl+b -> [ -> Ctrl+Space ->> Activate selection mode
  4. Alt+w -> ->> Copy selected text
  5. Ctrl+b -> ] ->> Paste copied text
  6. Ctrl+b -> Number-1-9 ->> Switch between windows
  7. Ctrl+b -> n ->> Next window
  8. Ctrl+b -> p ->> Previous window
  9. Ctrl+b -> Ctrl+s ->> Save tmux session
  10. Ctrl+b -> Ctrl+r ->> Restore session

Commands

  1. Rename session name -> :rename-session <new-session-name>
  2. Rename window name -> :rename-window <new-window-name>
  3. Create window -> :new-window -n <window-name>
  4. Re-order window -> :swap-window -s <source-win-no> -t <target-win-no>
  5. Kill Session -> :kill-session