gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

gnu linux

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

We’ve written about using GNU Screen to multitask in the Linux terminal in the past. GNU Screen is the granddaddy of these programs, but tmux and dvtm+dtach are other solutions you may prefer.

过去,我们已经写过关于在Linux终端使用GNU Screen进行多任务的文章。 GNU Screen是这些程序的祖父,但是您可能更喜欢tmux和dvtm + dtach。

Tmux is an improved rewrite of GNU Screen. Dvtm is a console multiplexer inspired by tiling window managers, and dtach adds the ability to detach from and reattach to dvtm sessions.

Tmux是对GNU Screen的改进重写。 Dvtm是受控制台窗口管理器启发的控制台多路复用器,并且dtach增加了与dvtm会话分离和重新附加的功能。

Tmux (Tmux)

As a rewrite of GNU Screen, tmux offers a variety of improvements. Some of the most important include a client-server model, which allows you to connect to a tmux session from multiple locations, and a cleaner configuration file format. Check out tmux’s FAQ to discover a list of ways it differs from GNU Screen.

作为对GNU Screen的重写,tmux提供了许多改进。 其中最重要的一些包括客户端服务器模型,该模型可让您从多个位置连接到tmux会话,以及更简洁的配置文件格式。 查阅tmux的FAQ来发现它与GNU Screen不同的方式列表。

Use this command to install tmux on Ubuntu:

使用以下命令在Ubuntu上安装tmux:

sudo apt-get install tmux

须藤apt-get install tmux

If you’re using another distribution, you’ll likely find it in your distribution’s package manager.

如果您使用的是其他发行版,则可能会在发行版的程序包管理器中找到它。

To launch tmux after installing it, just run the tmux command. Unlike Screen, tmux comes with a status bar by default.

要在安装后启动tmux,只需运行tmux命令。 与Screen不同,tmux默认带有状态栏。

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

To open an additional terminal window, use the Mod-c keyboard shortcut. The default modifer key combination is Ctrl-b. This means that you’ll have to press Ctrl-b and then c to create a new window.

要打开其他终端窗口,请使用Mod-c键盘快捷键。 默认的修饰键组合为Ctrl-b 。 这意味着您必须先按Ctrl-b ,然后按c来创建新窗口。

Each new window you open will appear in the status bar. By default, tmux only shows one window on the screen at a time.

您打开的每个新窗口都会出现在状态栏中。 默认情况下,tmux一次只在屏幕上显示一个窗口。

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

Here are some important keyboard shortcuts to get you started:

以下是一些重要的键盘快捷键,可帮助您入门:

Mod-X – Kill the current terminal.

Mod-X –终止当前终端。

Mod-n – Focus next window.

Mod-n –聚焦下一个窗口。

Mod-p – Focus previous window.

Mod-p –聚焦上一个窗口。

Mod-# – Focus the specified window, where # is a number between 0 and 9.

Mod - –聚焦指定的窗口,其中#是0到9之间的数字。

Mod-’ – Prompt for a window to select.

Mod-'-提示选择一个窗口。

Mod-% – Split the current window into two horizontally.

Mod - –将当前窗口水平拆分为两个。

Mod-” – Split the current window into two vertically

Mod-” –将当前窗口垂直拆分为两个

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

To detach from the current session, use the Mod-d keyboard shortcut.

要与当前会话分离,请使用Mod-d键盘快捷键。

To reattach to a session, run the following command:

要重新连接到会话,请运行以下命令:

tmux attach

tmux附加

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

For more keyboard shortcuts, run the man tmux command or read tmux’s manual on the web.

要获取更多键盘快捷键,请运行man tmux命令或在Web上阅读tmux的手册

DVD和Dtach (Dvtm & Dtach)

Unlike GNU Screen and tmux, dvtm doesn’t allow you to disconnect and reattach to sessions. You’ll have to run dvtm with dtach to detach from and reattach to your sessions.

与GNU Screen和tmux不同,dvtm不允许您断开连接并重新连接到会话。 您必须与dtach一起运行dvtm才能脱离会话并重新连接到会话。

Run this command to install dvtm and dtach on Ubuntu:

运行以下命令在Ubuntu上安装dvtm和dtach:

sudo apt-get install dvtm dtach

sudo apt-get install dvtm dtach

These programs should be available in other distribution’s software repositories, too.

这些程序也应该在其他发行版的软件存储库中可用。

Run the dvtm command to launch dvtm. You’ll see a single terminal window.

运行dvtm命令以启动dvtm。 您将看到一个终端窗口。

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

To open additional terminal windows, use the Mod-c keyboard shortcut. The default modifier key combination is Ctrl-g. This means that you’ll need to press Ctrl-g and then c to open a new terminal window.

要打开其他终端窗口,请使用Mod-c键盘快捷键。 默认的修饰键组合为Ctrl-g 。 这意味着您需要按Ctrl-g ,然后按c来打开新的终端窗口。

Like a tiling window manager, dvtm will lay out the terminal windows automatically. Unlike the other utilities, it displays them all on the screen by default.

像平铺窗口管理器一样,dvtm将自动布置终端窗口。 与其他实用程序不同,默认情况下,它将全部显示在屏幕上。

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

Here are some important keyboard shortcuts to get you started:

以下是一些重要的键盘快捷键,可帮助您入门:

Mod-x – Close the current window.

Mod-x –关闭当前窗口。

Mod-j – Focus next window.

Mod-j –聚焦下一个窗口。

Mod-k – Focus previous window.

Mod-k –聚焦上一个窗口。

Mod-# – Focus the specified window, where # is the number of the window.

Mod - –聚焦指定的窗口,其中#是窗口的编号。

Mod-q – Quit dvtm.

Mod-q –退出DVD。

For a full list, run the man dvtm command or check out dvtm’s manual page on the web.

有关完整列表,请运行man dvtm命令或在Web上查看dvtm的手册页

Dvtm also supports the mouse. For example, you can click one of the windows to select it.

DVDTM还支持鼠标。 例如,您可以单击一个窗口以将其选中。

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

To detach from a dvtm session and reattach to it later, you’ll have to run it with the dtach command. To launch dvtm with dtach, use the following command:

要与dvtm会话分离并在以后重新附加到该会话,则必须使用dtach命令运行它。 要使用dtach启动dvtm,请使用以下命令:

dtach -c /tmp/dvtm-session -r winch dvtm

dtach -c / tmp / dvtm-session -r绞盘dvtm

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

To detach from a dvtm session that’s been started with dtach, use the Ctrl-\ keyboard shortcut.

要与以dtach启动的dvtm会话分离,请使用Ctrl- \键盘快捷键。

To reattach to your dvtm session later, use the following command:

要稍后重新连接到dvtm会话,请使用以下命令:

dtach -a /tmp/dvtm-session -r winch

dtach -a / tmp / dvtm-session -r绞盘

gnu linux_Linux终端多任务处理的GNU屏幕的2种替代方法

You can use dtach to run, detach from, and reattach to other applications, too.

您也可以使用dtach运行,分离和重新附加到其他应用程序。



You may also want to check out byobu, which enhances GNU Screen.

您可能还需要签出byobu ,它可以增强GNU屏幕。

翻译自: https://www.howtogeek.com/114582/2-alternatives-to-gnu-screen-for-linux-terminal-multitasking/

gnu linux