Skip to main content
The cmux CLI provides a convenient interface to control cmux via the Unix socket.

Installation

The cmux CLI is bundled with cmux.app and automatically added to /usr/local/bin/cmux when you first launch the app. Verify installation:

Global flags

These flags can be used with any command:
string
default:"/tmp/cmux.sock"
Path to the Unix socket. Defaults to CMUX_SOCKET_PATH env var or /tmp/cmux.sock.
boolean
Output JSON instead of human-readable text.
string
default:"refs"
Output format for handles: refs, uuids, or both.
string
Target a specific window by ID, ref, or index. Commands will focus this window first.
string
Socket password for authentication (overrides CMUX_SOCKET_PASSWORD env var).

Open directory

Open a directory in cmux (launches cmux if not running):

System commands

version

Show cmux version:

ping

Test socket connectivity:

capabilities

List socket API capabilities:

identify

Get information about the current context:

Window commands

list-windows

List all windows:

current-window

Get the current window ID:

new-window

Create a new window:

focus-window

Focus a window:

close-window

Close a window:

Workspace commands

list-workspaces

List all workspaces:
Output:

new-workspace

Create a new workspace:
string
Set the working directory for the new workspace.
string
Run a command after creating the workspace (automatically appends \\n).

current-workspace

Get the current workspace ID:

select-workspace

Switch to a workspace:

close-workspace

Close a workspace:

rename-workspace

Rename a workspace:

move-workspace-to-window

Move a workspace to a different window:

reorder-workspace

Reorder workspaces in the sidebar:

workspace-action

Perform workspace actions:
Available actions:
  • next, previous, last: Navigate workspaces
  • select: Switch to workspace
  • close: Close workspace
  • rename: Rename workspace (requires --title)

Pane commands

list-panes

List panes in a workspace:

new-pane

Create a new pane:
string
default:"terminal"
Pane type: terminal or browser.
string
default:"right"
Split direction: left, right, up, down.
string
Target workspace ID/ref/index.
string
URL for browser panes.

focus-pane

Focus a pane:

list-pane-surfaces

List surfaces in a pane:

Surface/tab commands

list-panels

List surfaces (also called “panels” or “tabs”) in a workspace:

new-surface

Create a new surface in a pane:

new-split

Create a split from the current surface:

close-surface

Close a surface:

focus-panel

Focus a surface:

move-surface

Move a surface to a different pane/workspace/window:

reorder-surface

Reorder surfaces within a pane:

tab-action

Perform tab actions (surfaces can be called “tabs”):
Available actions:
  • next, previous: Navigate tabs
  • close: Close tab
  • rename: Rename tab (requires --title)
  • reload: Reload browser tab (requires --url for terminal tabs)

rename-tab

Rename a tab:

Terminal I/O commands

read-screen

Read terminal screen content:
boolean
Include scrollback buffer.
integer
Number of lines to read (implies --scrollback).

send

Send text to a terminal:
Use \\n for newlines and \\t for tabs. The CLI automatically unescapes these sequences.

send-key

Send a key sequence to a terminal:

Notification commands

notify

Create a notification:
string
required
Notification title.
string
Notification subtitle.
string
Notification body text.

list-notifications

List all notifications:

clear-notifications

Clear all notifications:
These commands update workspace sidebar UI with status, progress, and logs:

set-status

Set a status indicator:

clear-status

Clear a status indicator:

list-status

List all status indicators:

set-progress

Set a progress indicator:

clear-progress

Clear progress indicator:

log

Add a log entry to the workspace sidebar:
string
default:"info"
Log level: info, warn, error, debug.
string
Log source identifier.

list-log

List log entries:

clear-log

Clear all log entries:

Browser automation commands

All browser commands use the browser subcommand:

browser open

Open a URL in a new browser split:

browser navigate

Navigate to a URL:

browser back/forward/reload

Browser navigation:

browser url

Get current URL:

browser snapshot

Capture page snapshot (accessibility tree):
boolean
Include only interactive elements.
boolean
Show which element has focus.
boolean
Compact output format.
integer
Maximum tree depth.
string
CSS selector to scope snapshot.

browser eval

Execute JavaScript:

browser wait

Wait for page conditions:

browser click/hover/focus

Interact with elements:

browser type/fill

Fill input fields:

browser press

Press keyboard keys:

browser get

Extract element data:

browser is

Check element state:

browser find

Find elements by locator:

browser screenshot

Capture screenshot:

Tmux compatibility commands

These commands provide tmux-like functionality:

capture-pane

Alias for read-screen:

resize-pane

Resize a pane:

last-pane

Switch to last focused pane:

next-window / previous-window

Navigate workspaces:

clear-history

Clear terminal scrollback:

Advanced commands

tree

Show workspace hierarchy:

surface-health

Check surface status:

trigger-flash

Flash a surface visually:

drag-surface-to-split

Drag surface to create split:

refresh-surfaces

Refresh all surfaces:

Exit codes

  • 0: Success
  • 1: Error (error message written to stderr)

Examples