Reloading tmux config

If you have made changes to your tmux configuration file in the ~/.tmux.conf file, it shouldn’t be necessary to start the server up again from scratch with kill-server. Instead, you can prompt the current tmux session to reload the configuration with the source-file command.

This can be done either from within tmux, by pressing Ctrl+B and then : to bring up a command prompt, and typing:

:source-file ~/.tmux.conf

Or simply from a shell:

$ tmux source-file ~/.tmux.conf

This should apply your changes to the running tmux server without affecting the sessions or windows within them.

3 thoughts on “Reloading tmux config

  1. Or you can just add keybinding to your tmux.conf: bind-key r source-file ~/.tmux.conf \; display “Config reloaded!”

  2. I found this (https://github.com/brandur/tmux-extra) makes session management much nicer. It allows you to create a named session which you can then connect/disconnect as normal, but crucially you can connect to it more than once and have each connection operate independently (i.e. looking at a different window). My attempts to achieve the same just using tmux always left me with both connections switching windows in sync.

    • Chris,

      You can link 2 sessions together and have them behave independently (a bit like screen -x) using the -t option of the new-session command:

      $ tmux new-session -d -s "session1"
      $ tmux new-session -s "session2" -t "session1"
      

      That’s in fact what the shell script you mentioned in your post does.

      Cyril

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use Markdown if you want.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>