100
submitted 11 months ago by mozz@mbin.grits.dev to c/linux@lemmy.ml
all 22 comments
sorted by: hot top controversial new old
[-] mranderson17@infosec.pub 21 points 11 months ago

Mosh hasn't had a release in quite a while (Oct 2022). While that's not that old, and there does appear to be somewhat active development, it's a little slow moving for something that might be open to the internet directly. I used to use it but ssh with tmux is mostly fine and makes me feel a little safer because of their wider use.

[-] Cornelius@lemmy.ml 4 points 11 months ago

Hopefully talking about it more will interest more people in the project and possibly interest more people in contributing

[-] AbidanYre@lemmy.world 18 points 11 months ago

mosh with tmux makes it really painful when you have to go back to plain ssh

[-] steventhedev@lemmy.world 13 points 11 months ago

I worked with mosh for years to connect to servers on other continents. It was impossible to work otherwise. It only has two small warts: forwarding, and jump hosts.

The second is fixable/ish with an overlay network, but that isn't always an option if you don't control the network. I tried to solve this with socat but wasn't able to configure it correctly - something about the socket reuse flag was very unhappy.

[-] mozz@mbin.grits.dev 12 points 11 months ago* (last edited 11 months ago)

Yeah. I spend a majority of my working time on a slightly-unreliable Wifi network, and getting irritated that my keystrokes are lagging by some seconds and making it hard to e.g., edit the line I'm editing, is a daily occurrence. I literally had never heard of mosh before today, and when I tried it it was like the heavens opened up.

[-] steventhedev@lemmy.world 6 points 11 months ago

TCP was never designed with wifi in mind. TCP retransmission was only ever meant to handle drops due to congestion, not lossy links.

Tmux is a wonderful complement to mosh. Together you get persistence even when your local client loses power (speaking from experience)

[-] mozz@mbin.grits.dev 9 points 11 months ago* (last edited 11 months ago)

I still remember the professor in my networks class explaining how TCP worked, and then saying more or less:

Why doesn't it send a detailed mapping of which sections of the stream have been received and which haven't, allowing retransmission of only the dropped packets instead of what it does which is just backing up and blasting a whole new window's worth every time a single packet is dropped? Well, I don't know. It'd be a little more complex but the improvement in functionality would be so obviously worth it that it should. Don't know what to tell you. Anyway, this is how it works...

[-] steventhedev@lemmy.world 4 points 11 months ago

TCP Selective Ack is very much a thing, but it does take extra memory so lots of TCP stacks exclude it or disable it by default.

[-] bionicjoey@lemmy.ca 9 points 11 months ago

Mosh is great but it annoyingly doesn't preserve scrollback. So it needs to be combined with something like Tmux if you want to be able to see more than one page of terminal.

[-] confusedalex@feddit.de 5 points 11 months ago

Using fish with mosh always wasn't quite working as I wanted. The auto completions were always behind.

[-] mozz@mbin.grits.dev 2 points 11 months ago

Did you create an issue for it? Sounds like something that'd be worth them fixing.

[-] lntl@lemmy.ml 4 points 11 months ago

Personal bias: I'm a SSH/tmux zealot

How is this different/better than connecting to a tmux session on a remote machine?

[-] mozz@mbin.grits.dev 9 points 11 months ago

When you push up, up, Ctrl-A right right right, you don't have to sit there for 5 seconds and wait for the machine to decide it feels like fulfilling your request and showing you where the cursor is now so you can get on with what you were doing.

If you're not on flaky wireless networks a lot it might not be a huge difference, but from my experience today it was a big difference.

[-] lntl@lemmy.ml 3 points 11 months ago

Ctrl-a! love learning new things

Thanks for sharing :)

[-] mozz@mbin.grits.dev 6 points 11 months ago* (last edited 11 months ago)

Haha no problem. Yeah, Ctrl-A, Ctrl-R, Ctrl-K, and Ctrl-right/left are godsends for mucking around in the terminal, in case there were others of those you didn't know. Probably there are lots more but those are the ones I use all the time.

[-] zewm@lemmy.zip 2 points 11 months ago

How does this differ from something like tmux?

[-] Jordan_U@lemmy.ml 8 points 11 months ago* (last edited 11 months ago)

Tmux allows you to reconnect to a session, and helps guarantee that you will always be able to get back to your long running processes. For important long running processes, I still use tmux with mosh, because if the mosh client is killed (or you're trying to "re-attach" from a different device, mosh won't let you "re-attach" to that "session".

Mosh allows you to roam, and suspend your machine, and whenever you resume it again, whatever network you're now on, the connection is basically instantly re-established. You can often roam from WiFi to cellular data without even noticing. (Great when working from a phone, or just a laptop)

In my opinion, they are mostly orthogonal (and complementary).

Here's the list of features from the home page. I've added my own comments after '*'. If there is no '*', then the feature doesn't exist for tmux (because it's outside the scope of tmux):

Change IP. Stay connected. Mosh automatically roams as you move between Internet connections. Use Wi-Fi on the train, Ethernet in a hotel, and LTE on a beach: you'll stay logged in. Most network programs lose their connections after roaming, including SSH and Web apps like Gmail. Mosh is different.

Makes for sweet dreams. With Mosh, you can put your laptop to sleep and wake it up later, keeping your connection intact. If your Internet connection drops, Mosh will warn you — but the connection resumes when network service comes back.

Get rid of network lag. SSH waits for the server's reply before showing you your own typing. That can make for a lousy user interface. Mosh is different: it gives an instant response to typing, deleting, and line editing. It does this adaptively and works even in full-screen programs like emacs and vim. On a bad connection, outstanding predictions are underlined so you won't be misled.

No privileged code. No daemon. * Same for tmux, but that's less interesting since tmux is not a network service You don't need to be the superuser to install or run Mosh. The client and server are executables run by an ordinary user and last only for the life of the connection.

Same login method. * Not really relevant to tmux, which doesn't handle auth Mosh doesn't listen on network ports or authenticate users. The mosh client logs in to the server via SSH, and users present the same credentials (e.g., password, public key) as before. Then Mosh runs the mosh-server remotely and connects to it over UDP.

Runs inside your terminal, but better. * This is common to both Mosh is a command-line program, like ssh. You can use it inside xterm, gnome-terminal, urxvt, Terminal.app, iTerm, emacs, screen, or tmux. But mosh was designed from scratch and supports just one character set: UTF-8. It fixes Unicode bugs in other terminals and in SSH.

Control-C works great. * Tmux can help with this too Unlike SSH, mosh's UDP-based protocol handles packet loss gracefully, and sets the frame rate based on network conditions. Mosh doesn't fill up network buffers, so Control-C always works to halt a runaway process.

[-] Hellmo_Luciferrari@lemm.ee 4 points 11 months ago

I'm no expert, but this isn't a terminal multiplexer.

[-] bionicjoey@lemmy.ca 3 points 11 months ago

Mosh is to SSH as Tmux is to Bash

[-] Carunga@feddit.de 2 points 11 months ago

What do you guys think about Eternal Terminal? I quite like it. You can scroll!

[-] sxan@midwest.social 1 points 11 months ago

I had problems with CPU use; it has a polling model that wasn't very well tuned. The dev(s) are responsive, and suggested a work-around which helped the server, but eventually I went back to mosh. All my mosh connections are into tmux sessions, so the et benefits were not noticeable, and mosh is lighter on resources.

this post was submitted on 17 Jan 2024
100 points (100.0% liked)

Linux

48705 readers
1086 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS