如何更改tmux会话的起始目录? [英] How to change the starting directory of a tmux session?

查看:330
本文介绍了如何更改tmux会话的起始目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在其中启动tmux会话的目录将是所有新窗口将在其启动的目录.

The directory where you start a tmux session in will be the directory that all new windows will start at.

我的问题是,如何在不关闭会话的情况下更改此起始目录?

My question is, how can you change this starting directory without closing your session?

推荐答案

执行此操作的方法是从会话(具有默认键绑定的^b d)分离,然后在重新连接到该目录时指定其他目录.附加到会话时,使用-c标志指定工作目录.这是一个示例:

The way to do this is to detach from the session (^b d with the default keybindings) and then specify a different directory when you reattach to it. When attaching to a session, use the -c flag to specify the working directory. Here's an example:

$ tmux list-sessions
tmuxwtfbbq: 3 windows (created Tue Apr  5 14:25:48 2016) [190x49]
$ tmux attach-session -t tmuxwtfbbq -c /home/chuck/new_default_directory

此设置将保留-重新设置工作目录后,无需在每次重新连接到会话时都继续指定它.

This setting will be persisted - after you've reset the working directory, you won't need to keep specifying it every time you reattach to the session.

出于记录,我使用的是tmux 2.0版(尽管我认为这并不重要-我找不到在更改日志中向attach-session命令添加-c选项的任何信息,所以我假设它已经存在了很长时间).

For the record, I'm on tmux version 2.0 (though I don't think it matters - I couldn't find anything about adding a -c option to the attach-session command in the change logs so I assume it's been there for quite a while).

这篇关于如何更改tmux会话的起始目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆