Skip to main content
Browse referenceAll guides
Back to Commands
Miscellaneous

source-file

Short form: source

Execute commands from a file. This is typically used to reload the tmux configuration.

How source-file works

source-file reads a file and runs each line as a tmux command. Its everyday use is reloading your configuration after editing it: tmux source-file ~/.tmux.conf, or Prefix + : and then source ~/.tmux.conf, applies your changes without restarting tmux.

It accepts several paths and glob patterns, so you can split your config into pieces and load them all. -q skips files that don't exist without an error, which is perfect for optional per-machine files. -n parses the file without running anything, a handy syntax check, and -v prints each command as it runs.

There is no default key binding for reloading. Many configs add one, usually on Prefix + r.

Synopsis

bash
tmux source-file [-Fnqv] [-t target-pane] path ...

Options

FlagDescription
-FExpand format sequences in path
-nParse the file but don't run anything (a syntax check)
-qDon't report an error if the file doesn't exist
-vVerbose mode - show parsed commands with line numbers

Examples

Reload tmux config

bash
tmux source-file ~/.tmux.conf

Short form

bash
tmux source ~/.tmux.conf

Check your config for syntax errors without applying it.

bash
tmux source-file -n ~/.tmux.conf

In .tmux.conf: load an optional per-machine file and any extra snippets, without errors if they are missing.

bash
source-file -q ~/.tmux.local.conf
source-file -q ~/.config/tmux/conf.d/*.conf

Default Keybinding

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

Common Mistakes

  • Reloading only applies the lines that are in the file. If you delete a line, its old setting stays until you restart tmux (tmux kill-server) or undo it with set -u or unbind.
  • Prefix + r is already bound to refresh-client by default. Binding r to source-file replaces that, which is fine for most people but worth knowing.
  • Some options only affect new panes or windows, such as default-terminal and history-limit. Open a new pane to see those changes.

Pro Tips

  • •Add 'bind r source-file ~/.tmux.conf \; display "Reloaded!"' to your config
  • •Changes to some options require a restart to take effect
show-optionsset-option