I want to copy the default tmux.conf file to my home directory, but I can't find the location in Ubuntu 12.04. The man page states that the file resides at /etc/tmux.conf however this does not match with my setup.
-
5To find a file with name `
` in a directory ` – green Sep 24 '12 at 11:32` use the following command: `find -iname `.
7 Answers
You can use the current (default) settings as a starting point:
tmux show -g | cat > ~/.tmux.conf
Note the pipe to cat is required for now because of a known bug when redirecting tmux stdout to file.
- 951
- 6
- 2
-
21or `tmux show -g | sed 's/^/set-option -g /' > ~/.tmux.conf`: that would already prepend all the lines with a `set -g` – Tobias Kienzler Nov 06 '13 at 13:33
-
4
-
1@RutgerH start tmux then detach session then do this command. I also saw this :D – Kangarooo Nov 07 '17 at 17:32
-
5You don't need `cat`. Just do `tmux show -g > ~/.tmux.conf`. Using `cat` like this is known as UUOC - "useless use of `cat`". – shadowtalker Nov 22 '17 at 18:41
-
1
-
@RutgerH I also ran into this, thinking the command was a normal terminal command. No, write tmux in the command prompt and then run the command. – questionto42 Dec 28 '21 at 17:49
As per dpkg -L tmux which shows you what files the package installed, there is no default tmux.conf included in the package. /etc/tmux.conf is just a location that you may use (only makes sense with multiple users using tmux) that will be evaluated before ~/.tmux.conf. You have to create your own .conf file. Have a look at this for example (first hit on google):
https://web.archive.org/web/20160308115847/http://dev.gentoo.org/~wired/conf/tmux.conf
-
6Not Found The requested URL /~wired/conf/tmux.conf was not found on this server. Apache Server at dev.gentoo.org Port 443 – Kangarooo Nov 07 '17 at 17:33
-
@Kangarooo https://web.archive.org/web/20160308115847/http://dev.gentoo.org/~wired/conf/tmux.conf – Tarick Welling Oct 10 '22 at 13:08
There is no default /etc/tmux.conf file. You can start with the example conf files in /usr/share/doc/tmux/examples, or look at the manual/web/etc. to come up with your own configuration file.
The examples directory contains:
/usr/share/doc/tmux/examples/n-marriott.conf /usr/share/doc/tmux/examples/t-williams.conf /usr/share/doc/tmux/examples/vim-keys.conf /usr/share/doc/tmux/examples/h-boetes.conf /usr/share/doc/tmux/examples/screen-keys.conf
- 138,666
- 36
- 303
- 312
The top answer's tmux show -g | cat > ~/.tmux.conf did not work for me since I got a bunch of unknown command errors.
Upon further digging it has to do with the syntax change so tmux show -g no longer generates valid config files. You must prepend every line with set -g in order for this to work or run:
tmux show -g | sed 's/^/set -g /' > ~/.tmux.conf
- 337
- 4
- 15
Even the command in this answer leaves syntax error in conf file.
/users/kube/.tmux.conf:35: bad key: none
I suggest below command:
tmux show -g | sed -e 's/^/set -g /' -e 's/prefix2 none/prefix2 C-a/g' > ~/.tmux.conf
This solves two problems
- The syntax issue.
- It allows to use extra bind-key Controla which is easy to type than Control+b
- 193,181
- 53
- 473
- 722
- 11
- 3
Updated version of Daniel (2013) answer
You can use the current (default) settings as a starting point:
tmux start \; show -g | sed -e 's/^/set -g /' -e > ~/.tmux.conf
GNU screen compatibility
If you just need to add GNU screen compatible key prefix (CTRLa) as described in vijay's answer
tmux start \; show -g | sed -e 's/^/set -g /' -e 's/prefix2 none/prefix2 C-a/i' > ~/.tmux.conf
new location of the config
In current versions of Ubuntu you could also store the config file in ~/.config/tmux/tmux.conf see tmux change log for version 3.1
mkdir -p ~/.config/tmux/ ; tmux start \; show -g | sed -e 's/^/set -g /' -e 's/prefix2 none/prefix2 C-a/i' > ~/.config/tmux/tmux.conf
regarding Ubuntu 12.04
The original answer was this:
tmux show -g ; cat > ~/.tmux.conf
However Ubuntu 12.04 supposedly had tmux 1.7 (citation needed). Therefor "the list-keys format so that it shows the keys using actual tmux commands which should be able to be directly copied into the config file" ( per tmux change log) has been added at least since tmux version 1.5 which means, that the above original command should not have been working in Ubuntu 12.04 ¯\_(ツ)_/¯
improvements in this answer:
- incorporates Alex H's answer using
set -g - circumvents issue with
no server running on /tmp/tmux-1000/defaulterror - ignore case in
sed - alternative path
~/.config/tmux/tmux.conf(not Ubuntu 12) - detailing the changelog-archaeology
Note:
I actually tried to edit the top answer, but it was rejected as it incorporates changes not present in the original answer.
- 111
- 4
The config file is located in /usr/share/tmux, not in /usr/share/doc/tmux.
- 13,018
- 25
- 77
- 128
- 1