Skip to content

Tmux Usage Notes

calendar_today 2020.03.30
schedule 2 min read

Install

On macOS, install tmux via brew:

  1. brew search tmux
  2. brew info tmux
  3. brew install tmux

Config

Use the popular configuration found on GitHub, and follow the tutorial to install it.

Basic Concepts

  1. Session
  2. window
  3. pane

Introduction to the basic concepts

Understanding oh-my-tmux Configuration

Global settings: the prefix binding key defaults to Ctrl+b, which is inconvenient to use. oh-my-tmux additionally binds Ctrl+a as the prefix key.

Session Operations

OperationCommandDescription
New sessiontmux new -s demoCreate a session named demo
Check current session listtmux list-session /tmux lsList all current sessions; view only, no switching
Switch sessionprefix sList all sessions; use j/k keys to switch
rename sessionprefix $
kill-sessiontmux kill-session -t democlose demo session
kill-servertmux kill-serverclose server, everything gone
attach-sessiontmux attach-session -t sessionName

Window Operations

A window is usually split into multiple panes, though it defaults to a single pane. Similar to a Tab in iTerm.

OperationCommandDescription
New windowprefix cCreate a new window
Switch windowprefix numbere.g. switch to window 2: prefix 2
Close current windowprefix &
List all windowstmux list-windowShow all windows, marking the active window

Pane Operations

| Operation | Command | Description |

---|---|--- | Split window or pane horizontally | prefix - | Split a window or pane horizontally into two equal parts, similar to sp | | Split window or pane vertically | prefix _ | Similar to vs | | Temporarily maximize a pane | prefix z | The pane fills the entire window; run again to restore | | Show pane numbers | prefix q | |