11

I installed tmux via apt-get and there is no .tmux.conf file in my home directory, even after I run tmux.

I have been trying to follow a tmux tutorial, but the first part involves modifying this file, but since I do not have this file I am stuck. How do I get the tmux conf file?

18

There should be several example configuration files in either /usr/share/doc/tmux/examples or /usr/share/tmux/. You can copy any of those over to ~/.tmux.conf to test out.

Alternatively, you could create a ~/.tmux.conf with the default settings by using this command from within tmux:

tmux show -g > ~/.tmux.conf

This command works with tmux version 1.8.

In older versions of tmux, a bug regarding redirecting stdout to a file might require this command:

tmux show -g | cat > ~/.tmux.conf

More info can be found here.

  • Why is the | cat part necessary? – Anthon Jul 10 '16 at 15:19
  • It's not, at least in tmux 1.8. I've edited my answer to reflect this. – clk Jul 10 '16 at 15:28
  • 1
    I strongly suggest learning/teaching long forms of commands. Short forms tend to be very difficult to search for. Try searching manpages.ubuntu.com/manpages/xenial/en/man1/tmux.1.html for show-options then search for show. – Bruno Bronosky Mar 19 '18 at 18:11
5

If the .tmux.conf file does not exist, then you can simply create it. tmux would read it the next time you start tmux.

The rest of this answer concerns figuring out what the "default options" are, but note that you don't really need this unless you're interested in what they are.

The tmux utility's own show-options command with the -g flag will dump all the globally set options in the current tmux session (i.e., tmux has to be running to use it).

So if you're in a tmux session, your ~/.tmux.conf file is empty, then the following will dump out the default settings:

$ tmux show-options -g >tmux.conf-default

Some options are set by tmux by inspecting the shell environment. I, for example, get status-keys vi, presumably because I use Vi key bindings in my shell (EDITOR is set to vim).

In any case, you'll get the options that way. However, I've noticed that there is very little that I ever have to configure in tmux. I find it well set up by default for my taste, and I basically just re-set the prefix key to Ctrl+a (the b key is one step too far to the right for comfort on my Dvorak keyboard), and that's that.

If you don't need/want to change anything in the default options, then you don't need a .tmux.conf file.

0

if installed through homebrew then path would be "/usr/local/Cellar/tmux/2.8/share/tmux"

And in this location there would be a example conf file, you can create a new tmux.conf file at this location and then execute the following command "tmux source-file tmux.conf"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.