top | item 25740217

(no title)

oandrew | 5 years ago

[mosh or eternal terminal] + tmux combo solves the problem (and adds other cool functionality)

https://mosh.org/

https://eternalterminal.dev/

https://github.com/tmux/tmux/wiki

discuss

order

wnoise|5 years ago

I hate tmux because the way it handles switching windows is terrible. The model is switching between windows, each of which can have some layout of panes. This is approximately never what I want for a long-running thing I can detach from and reattach to, from a different terminal with different connections. Further, it supports multiple attachments by each having them see the same exact thing. For terminals that are different sizes, it shoves everything into an area the minimum height and width of all attached clients, and displays everything outside that as a field of periods.

I really prefer screen's functionality, instead. Each pane can be independently switched to any of the pool of underlying ptys being managed. The exact layout of panes is more of an ephemeral thing. On wide terminals I can split side-by-side, on narrow ones I can split top-above-bottom (and these can even be different for different clients connected to the server). It handles the multiple attached clients by only make

I think tmux's model is due to being too closely modeled on GUI virtual desktops.

That rant aside, tmux does have some nice features available by default that take a fair bit of configuration to get working well in screen.

em-bee|5 years ago

tmux supports multiple sessions and switching between those. sessions behave independently like your screen windows. you can of course have multiple windows in each session, which then behave the tmux way. you can also have the same window show up in multipe sessions and use that to emulate screen behavior. (i saw a script to help with that some time ago) for me, multiple sessions alone provide enough flexibility.

neurostimulant|5 years ago

> I think tmux's model is due to being too closely modeled on GUI virtual desktops.

Yes, using a terminal emulator that natively support tmux control mode (like iTerm2) is really nice because you can easily resize/rearrange the windows and panes via GUI actions, but absolutely suck when you have to reattach using a traditional terminal emulator because you now have to adjust all those windows and panes with keyboard actions.

wnoise|5 years ago

> It handles the multiple attached clients by only make

... by only making the ptys that are visible in multiple clients have the same size.

flaxton|5 years ago

Except that screen is dead :-/

nh2|5 years ago

If you require SSH features (e.g. port forwarding) or want to continue using your terminal's native scroll functionality, here's another alternative that a friend and I devised:

https://mazzo.li/posts/autoscreen.html

hansvs|5 years ago

This is great, thanks!

perryizgr8|5 years ago

I hate mosh because it nukes scrolling. I hate tmux because I just can't remember the keybindings. I've been using mosh+byobu since the keybindings are a bit easier for me. But I'd love regular ssh to be resilient like mosh, or maybe mosh can start supporting scrolling.

shakna|5 years ago

I use mosh + screen, because you can tell screen to act like it has normal scrolling with a simple config and then the only keybinding you need to remember is disconnect.

    defscrollback 500000
    scrollback 500000
    termcapinfo xterm* ti@:te@
There you go, normal scrolling!

boneitis|5 years ago

I got around the `tmux` barrier by writing down my most useful commands on an index paper, cutting it into the smallest rectangle I could (and folding in half), and tucking it in the pocket of my phone's flipcase (or you could stick it inbetween your smartphone and its back-shell).

I'm pretty happy I got over that hurdle.

FunnyLookinHat|5 years ago

Mosh is great - it drastically improved my ability to work remotely over my DSL connection.

Adding byobu made it effectively impervious.

steventhedev|5 years ago

As others have pointed out, mosh doesn't support port forwarding, and because ssh doesn't support udp forwarding, can't easily be used with proxyjump servers.

Story time: I had tmux sessions active on all our servers and would simply ssh into my work laptop from home, so the sessions were never really closed. One day, I decided to upgrade from 1404 to 1604 and closed out all my sessions (including on the servers because I was pushing out a new tmux config). After 5 minutes we started getting smss that the system was down and couldn't write to disk. One of our production servers had been set up with an encrypted home folder and when my session closed out, it closed the encrypted folder. Unfortunately, the ssh folder wasn't outside the encrypted portion, so we had to use IPMI to restore access. That's the story about how we started joking that closing my laptop is a great way to break the production system.

teddyh|5 years ago

This kind of thing is why I have always been very sceptical towards encrypted home directories, and have always advocated for full disk encryption.

ROARosen|5 years ago

I use tmux when when ssh-ing from an iPhone (which kills background apps after 10s), it works great for me.

I also use it when I know I'll need to finish something on a different machine.

hosteur|5 years ago

Which ssh client do you use? Is it free software? And if not, how do you trust it not to steal your keys?