Skip to main content
Browse referenceAll guides
Back to Commands
Miscellaneous

set-option

Short form: set

Set a session, window, or server option. Without -g, the option is set for the current session.

How set-option works

set-option, usually written set, changes tmux settings. Nearly every line in a .tmux.conf is a set command, from the prefix key to status bar colors.

Options live at four levels: server options (-s) for the whole tmux server, session options (the default), window options (-w), and pane options (-p). -g sets the global value that every session, window, or pane falls back to. tmux works out the level from the option's name for built-in options, so in practice set -g name value is enough most of the time.

-u unsets an option so it falls back to the global value, and -a appends to a string or style option instead of replacing it. For on/off options you can leave out the value to toggle it, which is handy for key bindings.

Synopsis

bash
tmux set-option [-aFgopqsuUw] [-t target-pane] option [value]

Options

FlagDescription
-gSet global option (affects all sessions/windows)
-aAppend to a string or style option
-uUnset option so it falls back to the global value
-wSet window option (same as setw)
-pSet pane option
-sSet server option
-oDon't change the option if it is already set
-qDon't complain about unknown or ambiguous options
-FExpand formats in the value

Examples

Enable mouse globally

bash
tmux set -g mouse on

Change prefix to Ctrl+a

bash
tmux set -g prefix C-a

Start window numbering at 1

bash
tmux set -g base-index 1

Increase scrollback buffer

bash
tmux set -g history-limit 10000

Toggle typing into every pane of the window at once. Run it again to turn it off.

bash
tmux setw synchronize-panes

In .tmux.conf: show the time on the right of the status bar, then append the host name.

bash
set -g status-right '%H:%M'
set -ag status-right ' #H'

Default Keybinding

set-option has no default key. Run it from a shell as tmux set-option, type it at the command prompt (Ctrl+b then :), or give it a key with bind-key.

Common Mistakes

  • Without -g, the setting only applies to one session or window, so new ones won't get it. In .tmux.conf, almost every set should use -g.
  • Some options only affect panes or windows created after the change, such as history-limit and default-terminal. Open a new pane to see the effect.
  • A typo gives 'invalid option: mous'. Check names with tmux show-options -g, or look them up in man tmux.

Pro Tips

  • •Use -g for options that should apply to all sessions
  • •Put these in your .tmux.conf for persistence
show-optionsset-window-option