Connecting via Mosh Server and Running Tmux
Mosh (Mobile Shell) is a remote terminal application that allows users to connect to a remote server over a cellular network or Wi-Fi, and it is designed to handle connection drops and other issues that can occur with traditional SSH connections. Tmux (Terminal Multiplexer) is a terminal multiplexer that allows users to run multiple terminal sessions within a single terminal window, detach and reattach to those sessions later, and split the terminal window into multiple panes.
Connecting via Mosh Server
To connect to a remote server via Mosh, you can use the following command:
mosh @
Where is your username on the remote server, and is the IP address of the remote server.
Running Tmux
Once you are connected to the remote server via Mosh, you can start a new Tmux session on the remote server by using the following command:
tmux new -s
Where is the name you want to give to the new Tmux session. This will create a new Tmux session with the specified name, and you will be placed in the first pane of that session.
Running Another Tmux Inside
You can also run another Tmux session inside an existing Tmux session. To do this, you can use the following command:
tmux new -s -t
Where is the name you want to give to the new Tmux session, and is the name of the existing Tmux session in which you want to create the new session.
Line Wrap Not Working Correctly in Tmux and Mosh
One issue that some users have reported is that line wrapping does not work correctly in Tmux when using Mosh as the terminal emulator. This can cause text to be displayed incorrectly, with lines being cut off or wrapped in unexpected ways. One possible solution to this problem is to use the set-window-option command to set the window-size option to manual, as shown below:
tmux set-window-option window-size manual
This will disable automatic window resizing, which can help to prevent line wrapping issues in Tmux when using Mosh.
- Mosh is a remote terminal application that allows users to connect to a remote server over a cellular network or Wi-Fi.
- Tmux is a terminal multiplexer that allows users to run multiple terminal sessions within a single terminal window, detach and reattach to those sessions later, and split the terminal window into multiple panes.
- To connect to a remote server via Mosh, use the command
mosh.@ - To start a new Tmux session on the remote server, use the command
tmux new -s. - To run another Tmux session inside an existing Tmux session, use the command
tmux new -s.-t - To prevent line wrapping issues in Tmux when using Mosh, use the command
tmux set-window-option window-size manual.