cmuxterm

CLI Reference

Command-line interface for cmuxterm

CLI Reference

cmuxterm includes a command-line tool for controlling the terminal from scripts and other tools.

Installation

The CLI is bundled with cmuxterm. Inside cmuxterm terminals, it's available automatically. For external use:

# Create symlink to CLI
sudo ln -sf "/Applications/cmuxterm.app/Contents/MacOS/cmuxterm" /usr/local/bin/cmuxterm

Global Options

OptionDescription
--socket PATHUse a custom socket path
--jsonOutput in JSON format
--tab IDTarget a specific tab
--panel IDTarget a specific panel

Environment Variables

VariableDescription
CMUX_SOCKET_PATHDefault socket path
CMUX_TAB_IDDefault tab ID
CMUX_PANEL_IDDefault panel ID

Commands

Tab Management

list-tabs

List all open tabs.

cmuxterm list-tabs
cmuxterm list-tabs --json

new-tab

Create a new tab.

cmuxterm new-tab

select-tab

Switch to a specific tab.

cmuxterm select-tab --tab <tab-id>

current-tab

Get the current tab info.

cmuxterm current-tab
cmuxterm current-tab --json

close-tab

Close a tab.

cmuxterm close-tab --tab <tab-id>

Split Management

new-split

Create a new split pane.

cmuxterm new-split right
cmuxterm new-split down
cmuxterm new-split left
cmuxterm new-split up

list-panels

List panels in the current tab.

cmuxterm list-panels
cmuxterm list-panels --json

focus-panel

Focus a specific panel.

cmuxterm focus-panel --panel <panel-id>

Input Commands

send

Send text to the terminal.

cmuxterm send "echo hello"
cmuxterm send "ls -la\n"  # Include newline to execute

send-key

Send a key press.

cmuxterm send-key enter
cmuxterm send-key tab
cmuxterm send-key escape

send-panel

Send text to a specific panel.

cmuxterm send-panel --panel <panel-id> "command"

send-key-panel

Send a key press to a specific panel.

cmuxterm send-key-panel --panel <panel-id> enter

Notifications

notify

Send a notification.

cmuxterm notify --title "Title" --body "Message body"
cmuxterm notify --title "Title" --subtitle "Subtitle" --body "Body"

list-notifications

List all notifications.

cmuxterm list-notifications
cmuxterm list-notifications --json

clear-notifications

Clear all notifications.

cmuxterm clear-notifications

Utility

ping

Check if cmuxterm is running and responsive.

cmuxterm ping

Examples

Build Script with Notification

#!/bin/bash
npm run build
if [ $? -eq 0 ]; then
    cmuxterm notify --title "✓ Build Success" --body "Ready to deploy"
else
    cmuxterm notify --title "✗ Build Failed" --body "Check the logs"
fi

Create Tab and Run Command

#!/bin/bash
# Create a new tab
result=$(cmuxterm new-tab --json)
tab_id=$(echo "$result" | jq -r '.id')
 
# Select the new tab
cmuxterm select-tab --tab "$tab_id"
 
# Send a command
cmuxterm send "npm run dev\n"

Monitor Multiple Tabs

#!/bin/bash
# List all tabs and their directories
cmuxterm list-tabs --json | jq -r '.tabs[] | "\(.title): \(.directory)"'