tmux

1. Installation

MacBook (Homebrew):

brew install tmux

Check:

tmux -V

2. Basic Structure

  • Session : An independent workspace (can be created per project)
  • Window : A tab within a session
  • Pane : A split screen within a window

In other words:

Session > Window > Pane


3. Session Management

  • Start a new session

    tmux
  • Start with a name

    tmux new -s mysession
  • Detach a session → keeps running but hidden from view

    Ctrl+b d
  • List sessions

    tmux ls
  • Reattach a session (attach)

    tmux attach -t mysession
  • End a session → inside the session, exit


4. Key Shortcuts (prefix = Ctrl+b)

tmux uses all commands entered after a prefix (Ctrl+b) .

ActionShortcut
New window (tab)Ctrl+b c
Switch windowsCtrl+b n / Ctrl+b p
Go to a specific windowCtrl+b <번호>
Split pane (vertical)Ctrl+b %
Split pane (horizontal)Ctrl+b "
Move between panesCtrl+b + arrow keys
Resize paneCtrl+b + Alt + arrow
Close paneCtrl+b x
List windows/panesCtrl+b w
Rename session`Ctrl+b

1. Installation

MacBook (Homebrew):

brew install tmux

Check:

tmux -V

2. Basic Structure

  • Session : An independent workspace (can be created per project)
  • Window : A tab within a session
  • Pane : A split screen within a window

In other words:

Session > Window > Pane


3. Session Management

  • Start a new session

    tmux
  • Start with a name

    tmux new -s mysession
  • Detach a session → keeps running but hidden from view

    Ctrl+b d
  • List sessions

    tmux ls
  • Reattach a session (attach)

    tmux attach -t mysession
  • End a session → inside the session, exit


4. Key Shortcuts (prefix = Ctrl+b)

tmux uses all commands entered after a prefix (Ctrl+b) .

ActionShortcut
New window (tab)Ctrl+b c
Switch windowsCtrl+b n / Ctrl+b p
Go to a specific windowCtrl+b <번호>
Split pane (vertical)Ctrl+b %
Split pane (horizontal)Ctrl+b "
Move between panesCtrl+b + arrow keys
Resize paneCtrl+b + Alt + arrow
Close paneCtrl+b x
List windows/panesCtrl+b w
Rename session

5. Practical Examples

(1) Keeping Remote Server Work Alive

ssh user@server
tmux new -s deploy
  • Run the tmux session on the server → detach with Ctrl+b d → session persists even after SSH disconnects
  • After reconnecting:
tmux attach -t deploy

(2) Viewing Server Logs + Running Processes at the Same Time

  • Ctrl+b % → split left/right
  • Run the server on the left, tail -f logs/app.log on the right

(3) Managing Multiple Projects

  • tmux new -s projectA
  • tmux new -s projectB
  • Switch as needed with tmux attach -t projectA / tmux attach -t projectB

6. Customization

Config file: ~/.tmux.conf

Example:

# prefix 키를 Ctrl+a로 변경 (screen 스타일)
unbind C-b
set -g prefix C-a
bind C-a send-prefix

# 마우스 지원
set -g mouse on

# 창 번호 1부터 시작
set -g base-index 1
setw -g pane-base-index 1

Apply:

tmux source-file ~/.tmux.conf

7. Summary

  • Session: Per-project unit
  • Window: Tab concept
  • Pane: Split screen
  • Key shortcuts: Ctrl+b %, Ctrl+b ", Ctrl+b c, Ctrl+b d