35

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?

2

3 Answers 3

37

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.

4
  • 1
    Why is the | cat part necessary?
    – Anthon
    Commented Jul 10, 2016 at 15:19
  • It's not, at least in tmux 1.8. I've edited my answer to reflect this.
    – clk
    Commented Jul 10, 2016 at 15:28
  • 5
    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. Commented Mar 19, 2018 at 18:11
  • Strange to note for the most, but happened to me: I thought the command would be run from the Linux normal terminal. You need to run it inside tmux. Commented Dec 28, 2021 at 17:47
12

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.

1

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"

1
  • 1
    Never would have found this, thank you! Also, it varies by version, for example: /usr/local/Cellar/tmux/3.2a_1/share/tmux/example_tmux.conf
    – Ahi Tuna
    Commented Mar 30, 2022 at 13:45

You must log in to answer this question.

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