Roger Fan

Notes

High School Notes
University Notes
Computer Networking
Computer Architecture
Operating System
Chapter 0
Chapter 1: Operating System Introduction
Chapter 2: OS Structure
Chapter 3: Process Concept
Chapter 4: Multithreaded Programming
Chapter 5: Process Scheduling
Chapter 6: Process Synchronization
Chapter 7: Deadlocks
Chapter 8: Memory Management
Chapter 9: Virtual Memory Management
Chapter 10: File System Interface
Chapter 11: File System Implementation
Chapter 12: Mass Storage System
Chapter 13: IO System
Discrete Math
Calculus
Calculus I
Calculus II
Linear Algebra
Probability
General Physics
General Education
Tech Notes
TMUX
SSH
Fail2ban
SSHD
UFW
DNS Bind9
Notes
Tech Notes
TMUX

TMUX

Created: 2025-11-30
Updated: 2025-11-30

Comprehensive TMUX notes including essential commands and configuration. Check out my dotfiles for complete development environment configs.

roger@roger.tw
roger@roger.tw
© 2026 Roger Fan. All rights reserved.

Useful Command

  • All Commands

TPM

  • Install Plugins: <prefix> I
  • Update Plugins: <prefix> U
  • Remove Plugins: <prefix> opt u
  • Remove Plugins: ~/.tmux/plugins/tpm/bin/clean_plugins

Sessions

  • Create New Session: tmux / tmux new -s {newSessionName} / <prefix> :new -s {newSessionName}
  • Rename: <prefix> $
  • List Session: tmux ls / <prefix> s
  • List Session and Windows: <preifx> w
  • Switch Session:
    • <prefix> ): next session
    • <prefix> (: previous session
  • Attach: tmux a / tmux a -t {SessionName}
  • Detach: <prefix> d
  • Kill: tmux kill-session -t {SessionName} / <prefix> :kill-session

Windows

  • Create New Window: <prefix> c
  • Rename: <prefix> ,
  • Toggle Last Active Window: <prefix> l
  • Switch Windows:
    • <prefix> {number}
    • <prefix> n: next window
    • <prefix> p: previous window
  • Swap Windows: <prefix> :swap-window -s {number} -t {number}
  • Close Window: <prefix> &

Panes

  • Split Pane Horizontally: <prefix> %
  • Split Pane Vertically: <prefix> "
  • Toggle Last Active Pane: <prefix> ;
  • Switch Pane:
    • <prefix> {arrowKeys ← → ↑ ↓ }
    • <prefix> q + {number}
  • Swap Panes: <prefix> { and <prefix> }
  • FullScreen a Pane: <prefix> z
  • Resize Pane: <prefix> <C-{hjkl}> as vim
  • Turn Pane to Window: <prefix> !
  • Close Pane: <prefix> x
  • Merge W1 as Panes in W0: <prefix> :join-pane -s 1 -t 0
  • Move Pane from W0P1 to W1P2: <prefix> :join-pane -s 0.0 -t 1.2

Install

Bash
brew install tmux

TPM := TMUX Plugin Manager

Installation

Bash
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
mkdir ~/.config/tmux
touch ~/.config/tmux/tmux.conf
vim ~/.config/tmux/tmux.conf
  • edit ~/.config/tmux/tmux.conf

My TMUX config

Bash
# NOTE: Use <leader><S-I> to install plugins

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'

set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart
set -g @plugin 'tmux-plugins/tmux-continuum'
 -g @resurrect-capture-pane-contents 
 -g @continuum-restore 




set-option -g default-terminal 
set-option -ga terminal-overrides 
set-option -g default-shell 
set-option -g default-command 

set-option -g status-position top
set-option -g mouse on
set-option -g set-clipboard on
set-option -g focus-events on
set-option -s escape-time 0


set-option -g prefix C-Space
unbind-key C-b
bind-key C-Space send-prefix


 -g base-index 1
setw -g pane-base-index 1


unbind-key r
bind-key r source-file ~/.tmux.conf

set-window-option -g mode-keys vi
bind-key -T copy-mode-vi  send -X begin-selection    
bind-key -T copy-mode-vi  send -X copy-selection     
unbind-key -T copy-mode-vi MouseDragEnd1Pane 






 c new-window -c 
unbind-key %
bind-key | split-window -h -c 
unbind-key 
bind-key - split-window -c 


bind-key < swap-window -t -1
bind-key > swap-window -t +1


unbind-key j
unbind-key k
unbind-key h
unbind-key l

bind-key -r J resize-pane -D 1
bind-key -r K resize-pane -U 1
bind-key -r H resize-pane -L 2
bind-key -r L resize-pane -R 2
bind-key -r m resize-pane -Z

bind-key h previous-window
bind-key l next-window
bind-key j last-window


bind-key u run-shell 





 -g @plugin 

 -g @nova-nerdfonts 
 -g @nova-nerdfonts-left 
 -g @nova-nerdfonts-right 

 -g @nova-pane-active-border-style 
 -g @nova-pane-border-style 
 -g @nova-status-style-bg 
 -g @nova-status-style-fg 
 -g @nova-status-style-active-bg 
 -g @nova-status-style-active-fg 
 -g @nova-status-style-double-bg 

 -g @nova-pane 

 -g @nova-segment-mode 
 -g @nova-segment-mode-colors 

if-shell  \
   \
  
 -g @nova-segment-custom-colors 

if-shell  \
   \
  
 -g @nova-segment-whoami-colors 

 -g @nova-rows 0
 -g @nova-segments-0-left 
 -g @nova-segments-0-right 



run 
Bash
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
set
'on'
set
'on'
# set -g @continuum-save-interval '15' # automatically saves sessions for you every 15 minutes
### use prefix + Ctrl-s to save manually
### use prefix + Ctrl-r to restore manually
"tmux-256color"
",*:RGB"
"/bin/zsh"
"${SHELL} -li"
# Set prefix to Ctrl-Space
# Make index start from 1
set
# Refresh tmux setting
'v'
# start selecting text with "v"
'y'
# copy text with "y"
# don't exit copy mode when dragging with mouse
#
# Keymaps
#
# Create new panes and windows with current path, Split window
bind
"#{pane_current_path}"
"#{pane_current_path}"
'"'
"#{pane_current_path}"
# window movement
# Adjust pane size
# use "<leader>u" to toggle pane below
"pane_count=\$(tmux list-panes | wc -l | tr -d ' '); \ if [ \"\$pane_count\" -eq 1 ]; then \ tmux split-window -c \"#{pane_current_path}\" -l 10; \ elif [ \"\$(tmux display-message -p '#{window_zoomed_flag}')\" = \"1\" ]; then \ tmux resize-pane -Z; \ tmux select-pane -D; \ else \ tmux select-pane -U; \ tmux resize-pane -Z; \ fi"
#
# Themes
#
set
'o0th/tmux-nova'
set
true
set
set
set
"#78a2c1"
set
"#4c566a"
set
"#4c566a"
set
"#d8dee9"
set
"#89c0d0"
set
"#2e3540"
set
"#2d3540"
set
"#I.#W"
set
" #S"
set
"#{?client_prefix,#ffd182,#78a2c1} #2e3440"
"[ $(uname) = 'Darwin' ]"
"set -g @nova-segment-custom ' '"
"set -g @nova-segment-custom ' '"
set
"#89c0d0 #2e3440"
"[ $(uname) = 'Darwin' ]"
"set -g @nova-segment-whoami '#{#{=/-32/…:#{s|/Users/$USER|~|:#{pane_current_path}}}}'"
"set -g @nova-segment-whoami '#{#{=/-32/…:#{s|/home/$USER|~|:#{pane_current_path}}}}'"
set
"#78a2c1 #2e3440"
set
set
"mode"
set
"custom whoami"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
'~/.tmux/plugins/tpm/tpm'