ci Mosh: the mobile shell Mosh is a remote terminal application that supports…
- User
User: ci Mosh: the mobile shell Mosh is a remote terminal application that supports intermittent connectivity, allows roaming, and provides speculative local echo and line editing of user keystrokes.
It aims to support the typical interactive uses of SSH, plus:
Mosh keeps the session alive if the client goes to sleep and wakes up later, or temporarily loses its Internet connection.
Mosh allows the client and server to "roam" and change IP addresses, while keeping the connection alive. Unlike SSH, Mosh can be used while switching between Wi-Fi networks or from Wi-Fi to cellular data to wired Ethernet.
The Mosh client runs a predictive model of the server's behavior in the background and tries to guess intelligently how each keystroke will affect the screen state. When it is confident in its predictions, it will show them to the user while waiting for confirmation from the server. Most typing and uses of the left- and right-arrow keys can be echoed immediately.
As a result, Mosh is usable on high-latency links, e.g. on a cellular data connection or spotty Wi-Fi. In distinction from previous attempts at local echo modes in other protocols, Mosh works properly with full-screen applications such as emacs, vi, alpine, and irssi, and automatically recovers from occasional prediction errors within an RTT. On high-latency links, Mosh underlines its predictions while they are outstanding and removes the underline when they are confirmed by the server.
Mosh does not support X forwarding or the non-interactive uses of SSH, including port forwarding.
Other features Mosh adjusts its frame rate so as not to fill up network queues on slow links, so "Control-C" always works within an RTT to halt a runaway process.
Mosh warns the user when it has not heard from the server in a while.
Mosh supports lossy links that lose a significant fraction of their packets.
Mosh handles some Unicode edge cases better than SSH and existing terminal emulators by themselves, but requires a UTF-8 environment to run.
Mosh leverages SSH to set up the connection and authenticate users. Mosh does not contain any privileged (root) code.
Getting Mosh The Mosh web site has information about packages for many operating systems, as well as instructions for building from source.
Note that mosh-client receives an AES session key as an environment variable. If you are porting Mosh to a new operating system, please make sure that a running process's environment variables are not readable by other users. We have confirmed that this is the case on GNU/Linux, OS X, and FreeBSD.
Usage The mosh-client binary must exist on the user's machine, and the mosh-server binary on the remote host.
The user runs:
PATH, mosh accepts the arguments --client=PATH and --server=PATH to select alternate locations. More options are documented in the mosh(1) manual page.
- Assistant
安装 Mosh 后,您可以按照以下步骤开始使用它:
-
确保服务器端已安装 Mosh:
- 您要连接的远程服务器上也需要安装 Mosh,通常与本地的安装过程相似。
- 确保服务器的防火墙允许 UDP 数据包通过,默认端口范围是 60000 到 61000。
-
使用 Mosh 连接到远程服务器:
- 在终端中运行以下命令来启动 Mosh 会话:
mosh [username@]hostname - 替换
username为您的远程服务器用户名和hostname为服务器的地址或 IP。 - Mosh 初始会使用 SSH 进行认证登录,因此 SSH 必须在服务器上正常运行。
- 在终端中运行以下命令来启动 Mosh 会话:
-
会话使用:
- 成功连接后,您将看到与 SSH 类似的终端界面,可以正常进行命令行操作。
- 在切换网络或网络不稳定时,Mosh 会自动保持连接。
-
额外选项:
- 如果
mosh-client或mosh-server不在默认路径中,可以通过--client=PATH和--server=PATH指定路径。 - 使用
mosh --help可以查看更多命令行选项。
- 如果
-
结束会话:
- 直接在终端中输入
exit或logout命令结束 Mosh 会话。
- 直接在终端中输入
借助 Mosh 的特点,即使在网络状况不佳或切换网络的情况下,您都能享受稳定而连续的终端会话。
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.