Hacker News new | ask | show | jobs
by bradfox2 751 days ago
Is there anything better than tmux for this purpose? I need persistence but hate the key bindings and general interface.
11 comments

Byobu is equivalent, different hotkeys: https://www.byobu.org/

I have moved between tmux, byobu, and screen at various times in my career. I wouldn’t say one is better than the other, as they all do the job I need just fine (eg persistent session state on remote machines)

Byobu just works on top of either screen or tmux. By default it will try to use screen, but you can force it to use tmux with byobu-tmux.
Dtach[1] does session persistence and nothing else—it leaves refreshing the screen to the program running inside it (it can send a ^L or a SIGWINCH upon reattaching but that’s it).

[1] https://dtach.sourceforge.net/

+1 for dtach. That plus mosh and emacs works extremely well with no fuss.
Sounds like you might like Zellij: https://zellij.dev/
Could you say more about this? I took a look at this page and it seems to be mainly about having a window manager in a terminal: https://zellij.dev/about/

But I have a window manager, so all I ever want out of something like screen or tmux is a persistent remote session that survives network issues or me closing my laptop for a bit. Is that something that Zellij is better at?

In my experience? Yeah, Zellij's UX for session management vastly improves over that of screen and tmux, and it comes out of the box with much saner defaults. However, like tmux, it offers more than just session management, and also like tmux, it does it all while remaining rather small and performant.

Just try it and see if you like it. I've found that most of things I didn't like, mainly the default TUI borders and buttons, were far more easily reconfigured compared to tmux.

What about scriptability? Is Zellij as hackable as Tmux to create different plugins?
My use-cases are pretty basic, and my use isn't all that frequent, but I've been very happy with: https://zellij.dev/
On mac, iterm2 has excellent tmux integration. You start tmux in control mode (tmux -CC) and it opens a new window for that session with all the multiplexing handled by the terminal instead. You get to use all of your normal terminal keyboard shortcuts and terminal interface.

It is the best of both worlds. And, yes, of course it works with a remote ssh session.

There's still `screen` ? Also, I think tmux keys can be rebinded ?
Mosh is great if you have spotty, high latency connection with a lot of packet loss.
I use abduco for persistence - a very, very simple piece of code that -only- provides a persistent session, with one (configurable) keybinding to detach.

If you also want multiple terminals and screen splits and etc. it's designed to work with dvtm (by the same author) which provides that side of things.

Personally I tend to have a 2x2 grid of xterms on my local machine and four ssh connections to matching dtach sessions named project-{tl,tr,bl,br} but I suspect most people who aren't me would be happier with dvtm.

Does tmux allow redefining the key bindings?

GNU screen allows for redefining (at least) its hotkey. If tmux allows the same maybe you could redo the bindings more to your liking?

Yes you can define your own key bindings. The default is the same “prefix key” that ‘screen’ uses - Ctrl-b. Personally I like to use Ctrl-j because it’s easier to type and has fewer conflicts with shells and other things. Most of the key bindings that follow the prefix key seem natural to me, stuff like ‘c’ to create a new tab, ‘d’ to detach from tmux, ‘n’ to go to the next tab, etc., but all of that can be customized.
> The default is the same “prefix key” that ‘screen’ uses - Ctrl-b.

Isn't the default command key ctrl-A for screen? Which is why I've always had to change it (to ctrl-O which is much more sensible) because I can't live without ctrl-A in the terminal etc.

Yep. You can run tmux inside screen. Ctrl-A for screen, Ctrl-B for tmux. (Of course, you can redefine the command key in both screen and tmux.)
Yeah. Also happens to clash with my preferred window manager's prefix key (ratpoison).
You’re right! Thanks, yeah I can’t live without ctrl-a either, I use that all the time.
You can even use a sequence to activate it -- my prefix is "typing ` twice within x ms" and it avoids conflict.
In screen, I just use a single backtick, as I very rarely use it for any other application in a terminal session (I prefer "$()" in shell, invariably edit TeX and Lisp in GUI Emacs, and the only only other thing that comes immediately to mind is opening the developer console in mpv and various video games).
Yes, I like to use a backtick (`). Pretty nice except when typing in markdown, where I need to type a double backtick for each backtick.
Yes, I use C-z instead of C-b
yes, it does.

I love tmux and hate the default hotkey

I just use emacs. When my terminal drops, I just `emacsclient -t` and I'm back to work.
Depending on exactly what you mean by persistence, there's always mosh.