Skip to main content

Overview

Miscellaneous commands provide control flow, conditional execution, and utility functions in tmux.

if-shell

Alias: if
Execute a command conditionally based on the success or failure of a shell command.
flag
Run shell-command in the background.
flag
Do not execute shell-command. Instead, consider it successful if it is neither empty nor zero after formats are expanded.
string
The target pane for format expansion context.
string
required
Shell command to execute (or format to evaluate with -F).
string
required
Command to execute if shell-command succeeds (exits with 0). The second optional command is executed if it fails.

Format Expansion

Before being executed, shell-command is expanded using format rules.

Examples

run-shell

Alias: run
Execute a shell command or tmux command in the background without creating a window.
flag
Run the command in the background. By default, the command blocks.
flag
Execute as a tmux command instead of a shell command.
flag
Redirect the command’s stderr to stdout instead of ignoring it.
string
Set the current working directory to start-directory.
number
Wait for delay seconds before starting the command.
string
The target pane. Any output to stdout is displayed in view mode in this pane after the command finishes (unless -b is given or the command is a tmux command with -C).
string
Shell command to execute. Before execution, expanded using format rules.

Output Display

Without -C or -b, output to stdout is displayed in view mode in the target pane (or current pane) after the command finishes. The exit status is also displayed if the command fails.

Examples

wait-for

Alias: wait
Block or signal a channel for synchronization between commands.
flag
Lock the channel. Any clients that try to lock the same channel are made to wait until it is unlocked with -U.
flag
Signal the channel. Wake any clients waiting on this channel.
flag
Unlock the channel (use with -L).
string
required
The name of the channel to wait on, signal, lock, or unlock.

Behavior

Without options, prevents the client from exiting until woken using wait-for -S with the same channel.

Examples

source-file

Alias: source
Execute commands from one or more files.
flag
Expand formats in the file.
flag
Do not execute commands, just parse them and report errors.
flag
Suppress errors about non-existent files.
flag
Verbose output showing each command as it is executed.
string
required
Path to configuration file(s) to source. Can specify multiple files.

Examples

clock-mode

Display a large clock in the target pane.
string
The target pane.
Press any key to exit clock mode.
  • clock-mode-colour: Color of the clock
  • clock-mode-style: Clock format (12 or 24)

Examples

lock-server

Alias: lock
Lock each client individually by running the command specified by the lock-command option.
  • lock-command: Command to run when locking (default: lock -np)
  • lock-after-time: Lock session after seconds of inactivity (default 0, disabled)

Examples

confirm-before

Alias: confirm
Ask for confirmation before executing a command.
flag
Show the prompt in the background (allow other commands to run).
string
Custom prompt message. Default is “command (y/n)”.
string
The target client for displaying the prompt.
string
required
The command to execute if confirmed.

Examples

command-prompt

Open a command prompt in the status line.
flag
Accept only one key press as input.
flag
Expand formats in the template.
flag
Execute the template immediately without waiting for user input.
flag
Accept a key name instead of a command.
flag
Accept only numeric input.
flag
Accept only a target (session, window, or pane).
flag
Accept only a window name.
string
Comma-separated list of initial input values.
string
Comma-separated list of prompt strings.
string
The target client.
string
Command template. %% is replaced by the user’s input, or %1, %2, etc. for multiple prompts.

Examples

list-commands

Alias: lscm
List the syntax of commands supported by tmux.
string
Format for each line. Available format variables:
  • #{command_list_name}: Command name
  • #{command_list_alias}: Command alias
  • #{command_list_usage}: Command usage
string
List only this command. If omitted, all commands are listed.

Examples

start-server

Alias: start
Start the tmux server if not already running. Normally not needed as the server is started automatically.

Practical Examples

Conditional Configuration

Background Jobs

Synchronized Setup

Interactive Prompts