Skip to content
IT related

TMUX

Updated 1 min read

Basic Usage

Starting and Managing Sessions

  • Start a New Session
    tmux
    
  • Start a Named Session
    tmux new -s mysession
    
  • Attach to a Session
    tmux attach -t mysession
    
  • List Sessions
    tmux ls
    
  • Detach from a Session
    • Press Ctrl + b, then d

Windows and Panes

  • Create a New Window
    • Press Ctrl + b, then c
  • Switch Between Windows
    • Press Ctrl + b, then n (next), p (previous), or a window number
  • Split Pane Horizontally
    • Press Ctrl + b, then %
  • Split Pane Vertically
    • Press Ctrl + b, then "
  • Navigate Between Panes
    • Press Ctrl + b, then use the arrow keys
  • Resize Panes
    • Press Ctrl + b, then hold Ctrl and use arrow keys

Advanced Usage

Custom Key Bindings

  • Reload Configuration
    bind r source-file ~/.tmux.conf
    
  • Resize Panes More Quickly
    bind -r H resize-pane -L 10
    bind -r J resize-pane -D 10
    bind -r K resize-pane -U 10
    bind -r L resize-pane -R 10
    

Session Management

  • Kill a Session
    tmux kill-session -t mysession
    
  • Rename a Session
    • Press Ctrl + b, then $

Copy and Paste

  • Enter Copy Mode
    • Press Ctrl + b, then [
  • Start Selection (in Copy Mode)
    • Press Space
  • Copy Selection (in Copy Mode)
    • Press Enter
  • Paste Clipboard
    • Press Ctrl + b, then ]

Examples of Custom Configuration (~/.tmux.conf)

  • Set Scrollback Buffer Size
    set -g history-limit 10000
    
  • Enable Mouse Support
    set -g mouse on
    
  • Change Status Bar Color
    set -g status-bg blue
    set -g status-fg white
    
  • Set Default Terminal to 256 Colors
    set -g default-terminal "screen-256color"
    

Practical Examples

  • Create a New Named Session for a Project
    tmux new -s project-name
    
  • Splitting the Window for Monitoring Logs
    • Start tmux, then split the pane horizontally (Ctrl + b, %) and tail logs in one pane while working in the other.
  • Using tmux for Remote Pair Programming
    • Both users attach to the same tmux session on a server to collaboratively work in real-time.
IT related RSS feed Published with Oblish

Keyboard shortcuts

/
Search
[
Previous page
]
Next page
?
Show this list
Esc
Close