tmux 嵌套 tmux_Tmux实践:本地和嵌套远程tmux会话

tmux 嵌套 tmux

by Alexey Samoshkin

通过阿列克谢·萨莫什金(Alexey Samoshkin)

Tmux实践:本地和嵌套远程tmux会话 (Tmux in practice: local and nested remote tmux sessions)

我们讨论了tmux功能,它们与本地和远程方案的相关性以及如何设置和配置tmux以支持嵌套会话 (We discuss tmux features, their relevance for local and remote scenarios, and how to setup and configure tmux to support nested sessions)

This is the first part of my tmux in practice article series. It is about using and configuring tmux v2, local and remote tmux sessions usage, and how to support a scenario when a remote tmux session is going to be nested inside a local tmux session.

这是我的tmux实践文章系列的第一部分。 它是关于使用和配置tmux v2,本地和远程tmux会话的用法,以及如何支持将远程tmux会话嵌套在本地tmux会话中的情况。

Before you start reading, here is a working example from my machine. We have a local tmux session on OSX inside iTerm2 (run in full screen mode). The local session has 2 windows: “zsh” and “node”.

在开始阅读之前,这是我机器上的一个有效示例 。 我们在iTerm2中的OSX上有一个本地tmux会话(以全屏模式运行)。 本地会话有2个窗口:“ zsh”和“ node”。

The “zsh” window is split into 2 panes: in both panes we SSH’ed to the remote hosts (CentOS7 and Ubuntu14) and jump into remote tmux sessions there.

“ zsh”窗口分为两个窗格:在两个窗格中,我们都通过SSH方式连接到远程主机(CentOS7和Ubuntu14),然后跳到那里的远程tmux会话。

The bottom pane with the Ubuntu14 remote session is further split into 2 panes, and we have 3 windows: shell, mon, and logs.

带有Ubuntu14远程会话的底部窗格进一步分为2个窗格,我们有3个窗口:shell,mon和log。

If you’re curious how it all works together, continue reading.

如果您好奇如何将它们一起使用,请继续阅读。

特征 (Features)

First let’s quickly go through tmux features and advantages, to understand their relevance to local or remote scenarios. We should clarify to ourselves why we need this “nested tmux in tmux” thing, because at first glance it looks pretty crazy.

首先,让我们快速浏览tmux的功能和优点,以了解它们与本地或远程方案的相关性。 我们应该向自己说明为什么我们需要这种“嵌套的tmux in tmux”,因为乍一看它看起来非常疯狂。

  1. Terminal multiplexing, named windows, split window into several panes. This makes more sense for the local environment, when you decide to supercharge your terminal emulator, which otherwise does not support aforementioned features. For example, iTerm or Terminator are already capable of multiplexing a terminal.

    终端多路复用(称为窗口)将窗口分为几个窗格。 当您决定为终端仿真器增压时,这对于本地环境更有意义,否则它将不支持上述功能。 例如,iTerm或Terminator已经能够复用终端。

  2. Setup and kick off tmux session with a pre-configured set of windows and panes, their arrangement, and commands run inside to avoid hassle of repeatedly setting up them again and again from scratch. For example:

    使用一组预先配置的窗口和窗格,它们的排列和命令来设置和启动tmux会话,以

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
conda是一个开源的软件包管理系统和环境管理系统,用于安装和管理不同版本的软件包和依赖项。tmux是一个终端复用器,可以在远程服务器上运行程序并保持会话的持久性,即使网络中断也能保持程序正常运行。 要在远程服务器上安装tmux,可以按照以下步骤进行操作: 1. 对于Linux系统,输入命令:sudo apt-get install tmux 对于Mac系统,输入命令:brew install tmux 如果你使用的是anaconda虚拟环境,你还可以使用conda install tmux命令来安装tmux。 2. 新建和退出tmux会话: 输入命令:tmux,进入新建的tmux会话窗口。 要退出tmux会话窗口,输入命令:exit。 要建立特定名称的tmux会话窗口,输入命令:tmux new -s 新建会话名称。 3. 查看、重命名、接入以及转换: 在未进入tmux窗口的情况下,输入命令:tmux ls,可以查看全部的tmux会话。 要重命名tmux会话,输入命令:tmux rename-session -t 原会话名称 新会话名称。 要进入已有的tmux会话,输入命令:tmux attach -t 会话名称。 进入了tmux会话窗口之后,输入命令:tmux switch -t 会话名称,可以转到对应的tmux会话。 4. 分离和终止: 进入了tmux会话窗口之后,输入命令:tmux detach,会退出当前会话,但会话会在后台继续存在,并且会话中运行的程序也会转到后台。 在未进入tmux窗口的情况下,输入命令:tmux kill-session -t 会话名称,可以强制终止会话,杀死tmux会话进程。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值