I'm reading over the tmux manual and as best I can tell, if set is given with no flags, it's a "session option" by default, which I assume to mean that it only applies to that one session.

If the -g flag is provided, it's a "global session" option. Which I assume to mean it applies to all sessions.

Now, if I do setw -g, that's a global window option, which I assume to mean that it applies to all windows in a session, which is the same as as set with no flag.

Then there is the -s flag, which means it applies across the entire server. This sounds like it would apply to all sessions, which sounds like the same thing as set -g flag. But I don't think this can be right. That doesn't sound right, though, because then why have two flags that do the same thing?


1 Answer 1


The link provided by StevieD "Possible duplicate of Difference between global, server, session and window options" is a great overview.

Basically, it's complicated. "set" can set server, window, and session options, and will work the same to set a server option with "set -s" or "set". However, it's good practice to include the "-s" when setting a server options because it prevents setting the option if it's not actually a server option. Examples of server options include buffer-limit and exit-unattached. If you use set -s to edit an option, then open a new terminal, the new terminal will reflect the changed option.

The "setw" command has less flags that can be used with it. "setw -s" doesn't make any sense because setw is specific to the window. (By the way, "set -w" is the exact same as "setw".) Similarly to the "set" command, -a appends the value to the existing setting, -F expands formats in the option value, -g sets/unsets a global option, -o prevents setting an option that's already set, -q suppresses errors about unknown or ambiguous options, and -u unsets an option so that a session inherits from the global options or if -g is also used then it actually changes that global option back to default.

So if I want to just change ONLY MY WINDOW's default shell to /bin/bzexe, I can run tmux setw default-shell /bin/bzexe

"set" sets an option which will remain unchanged when "set -g" is run. "setw" has different options from "set" and "setw -g" acts similarly to "set -g" in that setting that global will not change the value when checked with "show-window-option".

"set" options can be shown with "show-options" "setw" options can be shown with "show-window-option" All the above commands can be altered to instead look at the globals by adding a -g.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .