刚刚通过homebrew
安装了tmux,我正在尝试找到系统范围的tmux配置文件。手册页说明系统范围的文件应位于/etc/tmux.conf
,但由于某种原因它不在那里。默认的tmux.conf
文件位于何处?
注意:目前正在运行OSX Mavericks
据我所知,通过自制软件安装的tmux没有系统范围的conf文件。如果你确实需要一个,你可以在/etc/tmux.conf
添加自己的。但是,我想知道需要这个。我把配置放在~/.tmux.conf
,一切都很开心。
有一个/usr/local/Cellar/tmux/1.8/etc
目录,但它包含bash完成脚本。我还检查了usr/local/etc
它没有安装配置。
我非常有信心,通过自制软件的tmux安装程序不会安装它自己的系统范围的配置文件,而是将其作为sys管理员的练习,如果需要这样的功能的话。
你应该找到一些有用的东西:
/usr/share/doc/tmux/examples
最新版本的tmux只有示例conf文件,它不是OSX问题,只是新的默认tmux包装。所以你可以使用任何像这样的东西:
$cp /usr/share/doc/tmux/examples/someconffile.conf ~/.tmux.conf
应该这样做。
默认情况下,tmux没有可编辑的系统范围配置。它已被纳入该计划。
使用这些命令列出已编译的默认值,然后为您的用户创建自己的文件。
tmux list-keys # show current bindings
tmux show-options -s # show current server options
tmux show-options -g # show current global session options
tmux show-options # show current session options
tmux show-options -gw # show current global window options
tmux show-options -w # show current window options
使用tmux 1.7,show-options还可以显示单个选项的值(以前的版本只能列出指定类中的所有选项):
tmux show-options -gw window-status-format
“我会对它采取一些措施。这里有一些解决方案。我不运行Mac,但我运行RH,Debian,FreeBSD和Solaris,CYgwin和其他东西。
我的理解直接来自man tmux
。 -f
标志将指定备用配置文件。默认情况下,tmux
从/etc/tmux.conf
加载系统配置文件(如果存在),然后在~/.tmux.conf
中查找用户配置文件。配置文件是一组tmux
命令,它们在首次启动服务器时按顺序执行。
#!/usr/bin/env bash
unset temporary_array_tmp ; declare -a temporary_array_tmp
temporary_array_tmp=(/etc/tmux.conf ~/.tmux.conf)
# The next line creates an empty global and personal configuration file,
# if it individually does NOT exists.
for i_tmp in "${temporary_array_tmp[@]}" ; do
[[ ! -f "${i_tmp}" ]] && \
touch "${i_tmp}" && \
echo -en "I created an empty tmux configuration file @ ${i_tmp}. " && \
echo -e "You need to add configuration settings to ${i_tmp} ." || \
echo -e "The tmux configuration file ${i_tmp} already exists."
done
# After you add configuration settings, then you need
# to tell tmux to reload the files.
for i_tmp in "${temporary_array_tmp[@]}" ; do
[[ -f "${i_tmp}" ]] && \
tmux source-file "${i_tmp}" && \
echo -e "${i_tmp} The tmux configuration file ${i_tmp} is loaded." || \
echo -e "The tmux configuration file ${i_tmp} is NOT loaded."
done
unset temporary_array_tmp
接下来,您可以使用find
找到tmux目录和/或文件。例如:
find ~/ /etc /usr -iname *tmux*