Skip to main content

Command Mode and Prompt

The tmux command prompt is an interactive way to run tmux commands from inside any session. It is the equivalent of a built-in CLI for tmux management.

Core Idea

Ctrl+b : opens a command prompt at the bottom of your screen. Anything you type here is a tmux command — no tmux prefix needed.

Opening Command Mode

Ctrl+b :

A : prompt appears at the bottom of the screen. Type your command and press Enter.

Common Commands via the Prompt

# create a new window named "logs"
:new-window -n logs

# split current pane horizontally
:split-window -h

# rename current session
:rename-session newname

# set an option
:set -g mouse on

# reload config
:source-file ~/.tmux.conf

# kill current pane
:kill-pane

# kill current window
:kill-window

# switch to a session
:switch-client -t work

Running Commands from the Shell

Every command that works in the prompt also works from your shell with tmux <command>:

# These are equivalent:
# [inside tmux prompt] :new-window -n logs
# [from shell] tmux new-window -n logs

The prompt form is convenient when you are already inside a session.

Tab Completion in Command Mode

Tmux command mode supports tab completion for command names. Press Tab to complete command names.

Command Mode History

Press in command mode to cycle through previously entered commands.

Useful One-Liners via Prompt

# Display current time in the status line temporarily
:display-message "Time: #{b:pane_current_command} at #{b:session_name}"

# Move current window to index 0
:move-window -t 0

# Swap two panes
:swap-pane -s 0 -t 1

# Apply layout preset
:select-layout main-vertical

# Set history limit for current session
:setw -g history-limit 50000

# Send a command to another pane without focusing it
:send-keys -t work:logs "ls" Enter

Running Multiple Commands at Once (Shell)

From the shell, chain commands with \;:

tmux new-window -n build \; send-keys "make all" Enter

From the prompt, you can also chain:

:new-window -n build \; send-keys "make all" Enter

What's Next