Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The article misses the other great feature of Mosh: It never get disconnected, regardless of the client's state (IP address change, or device sleep mode), and you will never loose terminal sessions.

When this is not so appealing to desktop users, it is a godsend feature for laptop/mobile users. Especially, if you are an iPad user you should try Blink shell app [1] with Mosh. This combination turns the iPad your favorite portable terminal machine.

[1] https://blink.sh/



(author)

I was already using tmux for session persistence, so the local echo and handling of congested networks were the two features that made me wish I'd switched to mosh earlier.


mosh does persistence better, if you're connected to tmux over SSH it'll still disconnect as your IP changes on a roaming connection (like it does on my daily commute on the train). mosh does not, it stays no matter what. Also no need for autossh or similar to reconnect when you unsuspend your computer.


Of course there’s also the big problem of lack of scroll back in mosh as mosh actually handles the terminal emulation. I suppose this would be especially bad on an iPad with an on-screen keyboard, as the number of lines would be severely limited. How does Blink handle this problem?

(I use Prompt 2 on my 12.9’’ iPad Pro which doesn’t support mosh. I only use mosh on computers with very high latency servers.)


Yeah, Blinks doesn't handle the scrollback problem neither. I always use a bluetooth keyboard when I connect the shell so I launch tmux inside of it, so I use tmux's scrollback feature. Besides I don't much need scrollback when I use iPad anyway.

I have to admit that terminal is inherently not suited for touchscreen. Here I am suggesting iPad Pro a laptop alternative for a dedicated terminal use, where you use a physical keyboard.


I sometimes use Prompt with the on-screen keyboard when I'm working out on a treadmill. It's neither pleasant nor productive, but it's okay.

Btw, tmux scrollback sucks except when the terminal emulator's native scrollback is supported through control mode.


May I ask, why do you keep using Prompt? Full disclosure, I’m one of Blink Shell devs.


No particular reason, I picked it at first (when the iPad Pro 12.9'' came out in 2018, which incidentally was my first iPad) and it's been working okay for me, so not much of an incentive to shell out $20 for another terminal emulator. Also Panic is one of the more trustworthy shops out there (one of the reasons I picked it at first).


Fair enough, thanks!


But if you're running tmux then the "never get disconnected or lose terminal sessions" of mosh goes from major feature to minor feature.


You should anyway run mosh+tmux. Not sure about this though, ssh still disconnects and you have to reconnect and then launch tmux attach again. I agree it doesn’t seem like much, but just opening any device and continue from where you left off without any extra interaction feels great. It is kinda like auto save on iOS, you could argue that pressing the save and open button isn’t that big of a deal, but once you experience it the experience changes completely.


Any reasonable ssh client should be able to reconnect to a tmux session without any interaction. The benefit of it being instant is certainly nice, but I'd still classify it as minor, especially since forced disconnects are only really a problem that way on iOS.


> The article misses the other great feature of Mosh: It never get disconnected, regardless of the client's state (IP address change, or device sleep mode), and you will never loose terminal sessions.

I almost switched to mosh in the past while searching for this kind of solution to short-living ssh connections.

But I've finally never made the jump, re-launching ssh/tmux being four keystrokes only (up+enter x2). Not justifying changing the whole paradigm. Plus you get the additional bonus with tmux to be able to recover the same remote terminal sessions when switching computers (leave stuff in place at work, go home, continue on the same stuff at home).

Edit: maybe it's the time for jumping ships!


Well, just run tmux with Mosh. It gets even better.


Exactly. Close the laptop, connect to another network... as soon as you connect the network again you’re still on the server and your long running process still runs there.


Does the keepalive functionality in ssh help here? Like:

ssh -o ServerAliveInterval=5 -o ServerAliveCountMax=1 $HOST


There’s one place where it doesn’t (and can’t) help at all: when your address is changing frequently.

Suppose I’m doing some remote debugging stuff on my way to work. I have one IP on my home Wi-Fi. As I walk to my bus stop, it switches to LTE. As my bus drives through the city, I periodically jump to different addresses. I grab a coffee on my walk to the office and end up on the coffee shop’s Wi-Fi with their address. I leave and hop back to LTE, until I get to work and connect to its Wi-Fi.

With SSH, every one of those changes means reconnecting. With Mosh, it means that everything pauses for an instant and then resumes as if nothing ever happened.


Not really, one of the greatest things about mosh is it's ability to restore connections, even if you put your host to sleep, have a network outage, switch from wired to wireless, and the like. The connection just comes back like magic.


It's even useful for desktop users if you are hopping off and on a VPN.


Does mosh play well with MacOS?


Yes. I run a small Ultima Online custom server and it runs on a Debian box in a datacenter. My primary development machine is my macbook, and mosh-ing to my server is flawless, even from congested coffee shop wifi. The best part is I can use juicessh to mosh in from my phone if I need/want to as well!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: