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
tmux source-file [-Fnqv] [-t target-pane] path ...Options
| Flag | Description |
|---|---|
| -F | Expand format sequences in path |
| -n | Parse the file but don't run anything (a syntax check) |
| -q | Don't report an error if the file doesn't exist |
| -v | Verbose mode - show parsed commands with line numbers |
Examples
Reload tmux config
tmux source-file ~/.tmux.confShort form
tmux source ~/.tmux.confCheck your config for syntax errors without applying it.
tmux source-file -n ~/.tmux.confIn .tmux.conf: load an optional per-machine file and any extra snippets, without errors if they are missing.
source-file -q ~/.tmux.local.conf
source-file -q ~/.config/tmux/conf.d/*.confDefault 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
Related Commands
show-optionsset-option