tmux quick guide

por | 26 mayo, 2026

Tmux Guide: Master Terminal Multiplexing for Productivity

Tmux is a powerful terminal multiplexer that allows you to create multiple sessions, windows, and panes within a single terminal window. It’s especially useful for remote servers, long-running processes, and organizing your development workflow.

Basic Installation and Configuration

Install Tmux on macOS:

brew install tmux

Install Tmux on Ubuntu/Debian:

sudo apt update && sudo apt install tmux

Enable Mouse Support (Highly Recommended):

echo "set -g mouse on" >> ~/.tmux.conf

This allows you to click between panes, resize them, and scroll with your mouse/trackpad.

After making changes to ~/.tmux.conf, reload the configuration with:

tmux source-file ~/.tmux.conf

Session Management

  • Create a new session:
  tmux new -s session_name
  • List active sessions:
  tmux ls
  • Attach to an existing session:
  tmux attach -t session_name
  • Detach from current session (session continues running in background):
    Ctrl + B then D
  • Kill a specific session:
  tmux kill-session -t session_name
  • Kill all sessions (use with caution):
  tmux kill-server

Keyboard Shortcuts (Prefix: Ctrl + B)

All tmux commands start with the prefix key combination: Ctrl + B. Press and release it before pressing the command key.

Window Management

  • Create new window: Ctrl + B then C
  • Switch to next window: Ctrl + B then N
  • Switch to previous window: Ctrl + B then P
  • List all windows: Ctrl + B then W
  • Close current window: Ctrl + B then &

Pane Management

  • Split pane vertically: Ctrl + B then %
  • Split pane horizontally: Ctrl + B then "
  • Switch between panes: Ctrl + B then arrow keys (↑ ↓ ← →)
  • Resize current pane:
  • Ctrl + B then Ctrl + ↑ (resize up)
  • Ctrl + B then Ctrl + ↓ (resize down)
  • Ctrl + B then Ctrl + ← (resize left)
  • Ctrl + B then Ctrl + → (resize right)
  • Zoom in/out current pane: Ctrl + B then Z
  • Close current pane: Ctrl + B then X

Other Useful Shortcuts

  • Show key bindings help: Ctrl + B then ?
  • Rename current window: Ctrl + B then ,
  • Rename current session: Ctrl + B then $
  • Scroll mode (for viewing history): Ctrl + B then [
  • Use arrow keys or mouse wheel to scroll
  • Press Q to exit scroll mode

Additional Useful Commands

Create a session with a specific name and run a command:

tmux new -s dev -d "npm run dev"

Attach to the last session:

tmux attach

Switch between sessions quickly:

  • Ctrl + B then S (shows session list)

Send command to all panes in a window:

tmux setw synchronize-panes on

(Run your command, then turn off with off)

Custom .tmux.conf recommendations (add these for better experience):

# Improve colors
set -g default-terminal "screen-256color"

# Faster key repetition
set -s escape-time 0

# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1

# Vim-style pane navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

Pro Tips

  1. Running servers: Use tmux when running npm run dev, python manage.py runserver, or any long-running process so you can safely disconnect from SSH.
  2. Named sessions: Use descriptive names like api, frontend, database, logs.
  3. Plugin Manager (advanced): Consider TPM for installing community plugins.