> We are building the multiplexer for all work.
imo this would have been a better way to do the HN submission title (with or without [terminal])
> Superlogical: We are building the [terminal] multiplexer for all work
> We are building the multiplexer for all work.
imo this would have been a better way to do the HN submission title (with or without [terminal])
> Superlogical: We are building the [terminal] multiplexer for all work
I almost get tmux -- although I still don't understand why it's better than simply opening multiple terminal window instances like I've always done in Windows -- but I'm struggling to see how the concept of terminal multiplexing applies elsewhere.
So you launch a process with nohup(1). This puts SIGHUP and others on ignore status, redirects output to a file, and then executes your process. This is similar to how a daemon starts, when it explicitly dissociates from any terminal device.
With tmux or screen, a layer of pseudo-ttys (ptys) is created, and process groups are managed, so your terminal's pty is only connected to the master tmux process, and each subprocess/window is assigned a new pty and process group of its own, as if you had remotely logged in to each shell.
So tmux is now handling SIGHUP and can detect when your terminal or session closes out. The persistence of subprocesses comes from the fact that they aren't receiving SIGHUP and that they are still associated with pty, as tmux is running "daemonized" until you reattach.
The usual arguments make no sense if you’re only on your local machine:
- You can detach the session: well yeah, I can minimize the terminal window too.
- You can have multiple tabs/windows in a session: yup, same with my window manager
- You can keep multiple sessions and attach/detach from them whenever: I can do that with multiple desktops in my window manager
And so on.
But, once you want to do all of this on a remote server, it all makes sense: putting my laptop to sleep shouldn’t end the session on the server. If I get disconnected for some reason, I should be able to reattach and resume it if I reconnect. So then you have the session run on the server and you only “attach” to it when you connect, and if your terminal has good integration, new tabs become new tmux tabs etc… it’s all transparent.
It’s also useful if you’re running a session locally but anticipate wanting to attach to it from somewhere else: if your terminal session is tmux from the start, you can transparently attach to it from another machine too.
But, if you’re just dealing with one machine, who cares, just skip the multiplexer. (It’s literally not “multi” plexing if there’s only one client!)
Another thing worth mentioning is that if your terminal doesnt have good tmux integration, and you’re only running locally anyway, your life is strictly worse off with tmux: scrolling is a horribly broken hack, buffer search sucks, copy/paste never works, switching open terminals is an awkward ctrl+b contortion, etc. No amount of fiddling with your tmux config is going to make the UX as good as a decent terminal has, and I will die on this hill. :-)
This is based on developing on a remote server - but even locally, I find it invaluable. Multiple terminal windows are fine, but some times you want multiple windows. Even in a pre-ai world, you might want to run a process, see the code, edit, and maybe have htop or something like that. If you ever NEED multiple terminal windows for the same thing, tmux is really the answer.
So when I dip my toes into the Linux world, the first thing I do (or rather ask an LLM harness to do, being much less familiar with Linux than I am with Windows) is set up an RDP host. That way I can follow the same basic workflow on both OSes. I don't need to do anything special with terminal windows.
I guess if I were running truly headless systems that don't even have a VGA frame buffer, I'd be more interested in multiplexing. But so far I haven't had to do that, and would probably resist it because a persistent desktop strikes me as better in general than letting applications including terminals worry about their own lifetimes.
A multiplexer's job is to do the whole multiple tabs/panes/windows thing independently of the terminal itself, but (a) the UX for eg. tmux is so much worse than that of a good terminal UI, and (b) you only need that if you plan on connecting remotely (see my other comment https://news.ycombinator.com/item?id=49108483).