Overview
Miscellaneous commands provide control flow, conditional execution, and utility functions in tmux.if-shell
Alias:if
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
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
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 usingwait-for -S with the same channel.
Examples
source-file
Alias:source
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
string
The target pane.
Related Options
clock-mode-colour: Color of the clockclock-mode-style: Clock format (12 or 24)
Examples
lock-server
Alias:lock
lock-command option.
Related Options
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
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
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
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