Replacing tmux in my dev workflow

18 hours ago (bower.sh)

This is written for the Linux-on-the-Desktop crowd, and good for them. But tmux really shines for folks using MacBooks with iTerm2. Its tmux integration is so good that it simply disappears into my workflow.

With this in my `~/.ssh/config`, I can just type `ssh tmux` to get back to my remote dev box whenever I wake my computer or change connections.

    Host tmux
      HostName 1.2.3.4
      IdentityFile ~/.ssh/etc.etc.etc
      RequestTTY force
      RemoteCommand tmux -CC new -A -s 0

With iTerm2's tmux integration enabled, this will pop open a new window where the remote tmux tabs and scroll buffer look and act just like native, local iTerm2 tabs and scroll buffer. I don't even know any tmux commands.

  • I use a combination of mosh and screen for this. I only need to type something to get my session back, after a reboot. Changing networks or putting my laptop to sleep for days doesn't drop my sessions: https://www.grepular.com/Immortal_SSH_Sessions

    • Mosh is incredibly useful. I have sessions running from uptime until reboot with machines (pis and a desktop) on my local network from my laptop.

      I leave with the laptop, return days later, and perform no manual intervention to reconnect. It's absolutely brilliant.

  • I ran into so many little annoying color and font issues with vim, tmux and iTerm2 that I gave up on tmux (for local work). What small benefit I got from tmux on my local machine (basically surviving updates and a little more session persistence) I rarely miss.

    I wanted it to be better, and might go back if I could figure out the font issues, but I just don't have the time right now.

    • > vim, tmux and iTerm2

      Interesting, I've been using exactly that combination for ... as long as tmux and iTerm2 have been around?

      I am not aware of any color or font issues. What am I missing?

  • Wow, I've tried tmux like a hundred times and could never learn to like it, falling back to screen and promising to myself - never again. I'm going to break my promise to try this.

    • Isn't the screen equivalent literally this?

        Host tmux
            HostName 1.2.3.4
            IdentityFile ~/.ssh/etc.etc.etc
            RequestTTY force
            RemoteCommand screen -dR
      

      Edit: I guess it's missing the iTerm integration

  • Does any Linux terminal have a comparable integration? I'm still using GNU Screen but willing to give tmux another shot.

  • I've just now learned about tmux's control mode. Can you explain what that tmux -CC command does? I use `ssh -t <host> tmux attach -d` from bash history to (re)establish my remote tmux session. `new -A -s 0` would do the about same thing, I just don't see how -CC is supposed to work here.

    Edit: It appears to be related to iterm2's tmux integration. Neat.

  • Wow, I was wondering if e.g. Ghostty could implement something like this but that's cool it's already proven out.

    Does everything still go "through" tmux (so parsing etc. is still done twice), or does iTerm handle most of the rendering and just delegate scrollback storage/session persistence to tmux? The latter seems like the best of both worlds.

    • Composing simpler tools works better than complicated tools that try to solve everything.

      I am a former Kitty user and current Ghostty user and hope Ghostty stays basic and good.

  • Would mosh stop you from having to reconnect to SSH at least after wake? You'd still need to reestablish a mosh connection after rebooting.

    • Tmux cc mode doesn't work over mosh. Something to do with how it mangles binary going over the wire. Breaks other iTerm2 features like local copy paste from remote paste boards, drag and drop uploaf and download

This blog post reminds me of _why_ I use tmux. Did you see how much they needed to do to even resemble the workflow of tmux? Jeez, just use tmux. I don't mind dealing with wonky copy and paste once in a while.

> In summary: multiplexers add unnecessary overhead, suffer from a complexity cascade, because they actually have to translate escape codes, modifying them in hackish ways to get them to work with their concepts of windows/sessions.

What does that have to do with you using tmux? You're not the one maintaining tmux's codebase.

  • > I don't mind dealing with wonky copy and paste once in a while.

    This problem is in no way unique to tmux. You have the same problem with any terminal app that takes over drawing, eg vim. That said it is also easy enough to fix.

    The solution is OSC52, a terminal escape sequence that the emulator can use to interact with the system clipboard (kitty, alacritty, iterm2 all support this). The first step is to get you a script that writes out data in that protocol. Its easy enough:

        #!/usr/bin/env python3
        import os, base64, sys
        clip = base64.b64encode(sys.stdin.buffer.read())
        for pid in (os.getpid(), os.getppid()): # so that osc52-copy can be invoked by processes that themselves do not have a tty.
            cty = f"/proc/{pid}/fd/1"
            try:
                fd = os.open(cty, os.O_WRONLY)
                if os.isatty(fd):
                    os.write(fd, b'\x1b]52;c;') # the actual escape sequence
                    os.write(fd, clip)
                    os.write(fd, b'\a')
                    break
            except:
                continue
            finally:
                os.close(fd)
        else:
            raise SystemExit(f"no tty")
    
    

    Now you can do this:

    $ grep my_thing < some.txt | osc52-copy

    And whatever got into osc52 is now on your system clipboard.

    Tmux (set -g clipboard on) and nvim (unset clipboard) both have native osc52 support, and the script above can be used to integrate other places.

    • Terminal emulators have taken a very odd attitude toward OSC52. Many (or all?) of them selectively disable either copy, or paste, or both, depending on how cautious the maintainer is.

      Yes, it's true that an application that can read system clipboard content may scrape a password, but literally any application running in the terminal can read private keys out of your .ssh folder.

      With some heavy reading and a bit of experimentation, you can usually get this working, though.

    • I generally use xclip to copy program output. It has been around forever. Otherwise, I pipe into vim or I'm already using vim and I can copy via visual mode with "+y

  • I am tired of seeing people creating problems out of nowhere. The reasons author gave are stupid and I am gonna question his "7+ years" of tmux usage

    • I think some people should just admit they love tinkering with their tools instead of saying it is for productivity or whatever.

    • > and I am gonna question his "7+ years" of tmux usage

      Eh, lots of people use tools for ages without digging too deep.

I learned about Tmux just a few weeks ago and found out that one of the nifty features is that it is scriptable, I.e allows programmatically sending keystrokes to a specific pane. Then, inspired by some Japanese forums I asked myself if I can leverage this to have Claude Code actually interact with an interactive CLI script — we know CC can launch a script via bash but if said script waits for user input then CC can’t (easily) interact with it. Turns out yes we can leverage Tmux for this!

So I used Claude Code to build a little el tool called Tmux-cli, which gives a convenient way to have CC (or any CLI coding agent for that matter) spawn a Tmux Pane, launch a script there, and actually interact with it.

So it’s like Playwright/Puppeteer for the terminal.

You can get it via

    uv tool install claude-code-tools

https://github.com/pchalasani/claude-code-tools

There are some interesting possibilities this enables:

Let CC autonomously test interactive CLI scripts, without me having to intervene and point out errors.

Have the CLI coding agent launch UI from another pane and then use Puppeteer MCP to test from a browser.

Let CC launch a cli script with a debugger enabled (e.g. Pdb) and set breakpoints etc — for token-efficient code understanding, debugging and explaining.

Let the CLI coding agent spawn and drive another instance of the same or other CLI coding agent, AND interact with it. Note this is way better than CC sub-agents which are “spawn and let go” black-boxes.

I wonder if the discussed Tmux alternatives enable building this type of tool.

  • > and found out that one of the nifty features is that it is scriptable, I.e allows programmatically sending keystrokes to a specific pane

    In case anyone was curious, screen can do this too with the command "stuff" (read it as the verb like "stuffing something into a box").

  • Yup, another fun thing to do w/ this: let Claude Code talk to and control Gemini CLI, OpenCode, other CC instances, etc. in interactive mode! A different flavor of subagent. :)

  • Do you find the tmux-cli wrapper to improve results?

    I tell Claude to use the existing tmux CLI to send-keys, capture-pane, etc. and it works flawlessly. Literally just "never use the Bash tool, run all commands in tmux sessions" and it knows what to do from there.

    • One other thing I found is that when it spawns another Claude in a pane, and sends it a message, the enter key doesn’t register if sent immediately, so the other Claude doesn’t act on it. So in Tmux-cli I added a delay after experimenting with various values. I guess with plain Tmux it might run into this issue.

    • This is nice to know. I didn’t compare with plain Tmux but should. In Tmux-cli I set up some convenience functions and scaffolding to prevent accidentally killing itself etc. But yes if plain Tmux works well I would just use that; it’s one less context burden.

  • If you're interested in doing similar things but with a terminal, the Kitty remote control mechanism is pretty cool: https://sw.kovidgoyal.net/kitty/remote-control/

    • I'm reviewing the docs and interested in the scripting. I like that it uses python to script.

      Could I have kitty send each line it receives to an external tool, say via HTTP?

      I want to make a custom frontend to claude code, or any other CLI tool, and an obvious easy frontend is a web tool that communicates over HTTP, so getting claude wrapped in a HTTP control system seems like a good starting point.

      I'm interested in whether things like "tmux capture-pane" which strips characters come from Kitty as well? Do I need to be cautious of control characters?

  • > So it’s like Playwright/Puppeteer for the terminal

    I mean, a tty is just a file descriptor... there have been script(1), expect(1) and chat(8) since the 80ies. tmux is not really necessary.

> if you do not set TERM with tmux properly, your colors will render incorrectly

This is of course true of every other terminal emulator as well, and indeed it's not only colours that are incorrect. Function and editing keys get recognized incorrectly; REP can get used where it does not work; and even simple relative cursor motions can be done wrongly.

TERM and the ideas incorporated into terminfo/termcap are inherent in the way that terminal devices work on Unices and Linux-based operating systems. That there are different terminals and terminal emulators not all speaking exactly the same protocol is also an unavoidable reality.

Setting TERM properly isn't some tmux-specific problem.

  • Yet the author incorrectly blames it on tmux, which gives the article a bad taste.

    Also im not sure whether the scolling problem is actually tmux fault. Tmux uses the alternate screen buffer, the alternate screen buffer is activated using the smcup/rmcup terminfo capabilities, whose semantics actually say that it "fixes" the window viewport in-place so absolute cursor movement has a known zero position. In this state, any native scrolling attempt should have no effect, and the keypress/scroll wheel events should be forwarded to tmux directly.

    For some reason, every other terminal emulator still allows local scrolling in the alternate screen, which kinda breaks the semantics of smcup/rmcup and easy scrolling in tmux, too.

    • Sadly after experimenting with a bunch of "modern" terminals I'm forced to consider that their primary audience is more interest in ricing than actually implementing the terminal commands (or connecting to anything other than their favourite linux box) and so I'm stuck with xterm as the only reliable terminal emulator that won't occasionally spew unreadable junk.

      18 replies →

  • I agree. It's also true of nearly any program. If you do not set its configuration properly, it may not work as expected.

    In the case of TMUX, it can be a bit annoying because it's not immediately apparent _why_ things look wonky. But I'm not sure what the solution is. Default to 256 colors?

    • Indeed, the TERM environment variable actually is the configuration of "nearly any program" (excluding the ones that aren't doing explicitly terminal I/O, of course, and the bad ones that just ignore TERM and make assumptions). Set TERM wrongly, and one has set the configuration incorrectly for a whole load of programs, in one fell swoop.

  • > Setting TERM properly isn't some tmux-specific problem.

    Correct, but it's another layer to deal with. There are `tmux` specific TERMs that should be used which sit on top of your terminal emulator TERM. This was my point: you have another layer that you need to be aware of when using tmux and when debugging.

    Just look at the top of tmux's FAQ:

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

    > PLEASE NOTE: most display problems are due to incorrect TERM! Before reporting problems make SURE that TERM settings are correct inside and outside tmux.

    > Inside tmux TERM must be "screen", "tmux" or similar (such as "tmux-256color"). Don't bother reporting problems where it isn't!

    > Outside, it should match your terminal: particularly, use "rxvt" for rxvt and derivatives.

I still plan to keep using tmux. I like how it manages multiple sessions, making it easy to switch between projects and even resurrect them after rebooting. I also never had a problem with mouse copy / paste using tmux-yank. I've been using this set up for many years.

One cool feature of tmux is its ability to send keys. I did that a few months ago when I was revamping my dotfiles. I kept changing aliases and other shell files and wanted to source those files in dozens of panes at once and also reload neovim when I changed certain config files.

The above was pretty easy to pull off using a combo of tmux's built-in commands and a shell script. I made a post and video about that here: https://nickjanetakis.com/blog/running-commands-in-all-tmux-...

> In summary: multiplexers add unnecessary overhead, suffer from a complexity cascade, because they actually have to translate escape codes, modifying them in hackish ways to get them to work with their concepts of windows/sessions.

This is a feature for me. Because less and less applications bother supporting termcap, this way some applications can still work on my VT520.

I don't really care what the kitty dev thinks anyway. He's entitled to his opinion but for me tmux is way more important. Also I think alacritty is better (though I generally just use Konsole).

As a user I only care about what works well for me, not what's architecturally the most elegant solution.

  • You are very lucky to have a VT520. I have been idly on the look-out for a 525 for years, but not only are they inordinately expensive, the people selling them are not on the same continent as I am (and probably don't have my country's version of the LK).

    I've been on the lookout partly just to see whether this works properly with a genuine VT525:

    * https://jdebp.uk/Softwares/nosh/guide/commands/console-termi...

    Yes, should tmux ever go away, there's another option for transliterating terminal output of applications that just expect all of the modern stuff with AIXTerm's 16 colours and alternate screen buffers and mouse sequences and whatnot and do not check TERM properly. (-:

  • My VT420 doesn't support hardware flow control, but software flow control does not play nice with many modern terminal applications. GNU Screen provides an extremely effective workaround, plus its other features. I've used tmux a lot on modern terminal emulators, but it seems to lack this important feature for vintage terminals. Glad that tmux solves your problems with broken apps that don't support termcap or terminfo.

    • Fellow VT420 user here! The problem with tmux is that it disables flow control, but you can fix that with this:

        diff --git a/tty.c b/tty.c
        index 359dc13..f98c9c4 100644
        --- a/tty.c
        +++ b/tty.c
        @@ -319,8 +319,8 @@ tty_start_tty(struct tty *tty)
          event_add(&tty->event_in, NULL);
         
          memcpy(&tio, &tty->tio, sizeof tio);
        - tio.c_iflag &= ~(IXON|IXOFF|ICRNL|INLCR|IGNCR|IMAXBEL|ISTRIP);
        - tio.c_iflag |= IGNBRK;
        + tio.c_iflag &= ~(IXOFF|ICRNL|INLCR|IGNCR|IMAXBEL|ISTRIP);
        + tio.c_iflag |= IXON|IGNBRK;
          tio.c_oflag &= ~(OPOST|ONLCR|OCRNL|ONLRET);
          tio.c_lflag &= ~(IEXTEN|ICANON|ECHO|ECHOE|ECHONL|ECHOCTL|ECHOPRT|
              ECHOKE|ISIG);
      

      Then you'll want to run this before starting tmux:

        stty -iutf8 ixon
        export LANG=en_US
      

      I also recommend using a dedicated tmux socket with the VT to avoid accidentally connecting to an unpatched tmux server that helpfully re-disables flow control. That happened to me while I was testing the patch, and it was infuriating.

      I've also hacked up support for storing tmux window contents in different pages of VT memory, so you can switch windows instantly without waiting for full screen redraws. It's a bit rough around the edges (doesn't handle split windows very well, for example), but it's enough of a quality-of-life improvement that I use it anyway. It's a bit long for a comment, but I can post it somewhere if you're interested.

      Feel free to email me if you want more information about my setup.

  • > I think alacritty is better

    Can I ask why? It starts slower (has a significant lag on old hardware), has way less useful features (like tabs), has the same responsiveness, and loses in benchmarks (for what they're worth). I see no reason to use it when kitty/ghostty/konsole/foot exist (depending on one's preferences), but people obviously do.

I view "you might not need tmux" in the same way as "you might not need browser tabs".

Yes, if you only have one or two terminal sessions or open web pages then you can probably live without using them, but anything beyond that leads you into reimplementing features to cope with your desktop's lack of ability to manage dozens of windows.

  • That is something I have strived for recently, to use all the great window management features of my window manager of choice instead of browser tabs or lots of terminal tabs running tmux. If that didn't work well I guess it would have been a good sign that I need a better window manager. Even went back to use bookmarks instead of leaving hundreds of tabs open and having a bookmark bar instead of a tab bar is not bad at all.

  • I have come to believe that tab management is really the job of the window manager not individual apps. My window manager allows me to tile windows, or create tabs out of overlapping windows. The tabs can be from the same app or even different ones.

  • MS Windows has excellent multi window management with Alt Tab Win Tab etc. Far superior to others.

    I have all my terminals with distinct icons and background colours to tell them apart. The operating system (Windows) does the heavy lifting.

    i tried Mac for about five years but missed MS Windows “every window can be alt tabbed to”. Mac has “every app can be command tabbed to and therein each app has its own subwindow management”

    • > MS Windows has excellent multi window management with Alt Tab Win Tab etc. Far superior to others.

      If by "others" you mean Mac, okay, but KDE and some other Linux desktops are at least as good as Windows at this out of the box, and much more customisable.

    • > “every app can be command tabbed to and therein each app has its own subwindow management”

      This is so, so annoying. Your Mac app’s window is minimized? No alt-tab for you!

      9 replies →

    • Windows has basic window and desktop management, but I would hardly describe it as excellent. Most tiling window managers would provide those features and then more.

    • Alt-tab? You mean pressing win+w under CWM to fuzzy-find windows per title name, and then spawn it?

  • But many terminals have tabs so if all you desire is more than one terminal open but not multiple ui windows there are other options. VSCode for instance!

    • byobu+tmux lets me log into a remote machine once and then have multiple named sessions/workspaces each having multiple named tabs. The sessions persist when I disconnect and are there when I reconnect the next day. Is that possible with terminal tabs?

Kitty is great; I want to see it succeed in pushing terminal emulators forward into the current millennium. However, I can’t use kitty at work, and I absolutely live inside of tmux. The server is where all the action is, and when I get disconnected, I want to be able to pick things up exactly where I left them. Window layout, the state of each shell and text editor, what’s in the copy buffer, scrollback, everything. I can’t give that up unless I have a suitable replacement on Windows. Until then I will continue to use tmux at work and kitty at home.

  • I used Kitty for a while. I was impressed that I could recreate my tmux config pretty closely.

    I went back to tmux and basic terminal because it works everywhere, and composing tools is just more durable overall.

    • how do you do something like tmux sessions (not just windows) in kitty? how does switching sessions and windows work? can i connect to the same session in multiple windows? or can i manage separate windows with different sets of sessions?

> Another example is buffer scrollback. It's one of those things where you have to learn the tmux way of scrolling a window. You get used to it, of course, but it's just not great.

   And what about mouse select to copy/paste? It works most of the time, but
   sometimes tmux gets ignored and I'm selecting across splits which makes the
   thing I'm copying impossible to grab without bailing.

funny, those things make me use tmux! My 2nd laptop is a debian terminal-only laptop (it's very old), the mouse doesn't work so the only way to copy paste is tmux (or screen probably but I never learned it) For me, tmux is not replaceable

I have been tempted to drop tmux locally for native Ghostty panes/tabs, but I prefer the single height tmux status bar with window list only (set -g status-left '' + set -g status-right '') vs the thicker window decorations using macos-titlebar-style = tabs.

I did come up with Ghostty bindings to replicate my tmux settings if it helps anyone (my tmux leader is ctrl + space):

    # clear default bindings + add paste back
    keybind=clear
    keybind=super+v=paste_from_clipboard

    # navigate panes
    keybind=ctrl+h=goto_split:left
    keybind=ctrl+j=goto_split:bottom
    keybind=ctrl+k=goto_split:top
    keybind=ctrl+l=goto_split:right
    keybind=ctrl+space>shift+apostrophe=new_split:down
    keybind=ctrl+space>shift+five=new_split:right
    keybind=ctrl+space>space=equalize_splits
    keybind=ctrl+space>z=toggle_split_zoom

    # navigate tabs
    keybind=ctrl+space>c=new_tab
    keybind=ctrl+space>one=goto_tab:1
    ...
    keybind=ctrl+space>zero=goto_tab:10

  • Nice, I came up with something similar when trying ghostty. Were you able to replicate/setup continuous key hold for resizing? The way I have it it tmux is that doing leader,Shift+hold h/i/k/j continually resizes a pane while I keep holding for example Shift+h. But I wasn’t able to replicate it in ghostty

    • Never realized you can do that. Can you share that tmux binding? Right now I use `bind -r Space next-layout` for resizing (spam repeatedly).

This doesn’t sound like a “you might not need tmux” argument. It more just argues than tmux is a pita on the terminal ecosystem which I’m sure is true. But the workarounds described are just reimplementing tmux features by taping together a bunch of tools. A better argument I think is - a lot of people do need tmux, so perhaps we should rethink protocols etc to make many of these features more native

  • At one point I was wondering if there was a preexisting protocol for a character-based framebuffer of some sort, that we could then use to slice the problem in a different way: a framebuffer multipliexer running terminal emulators inside it instead of a terminal multiplexer emulating multiple terminals into a framebuffer and then translating it back into terminal controls for the parent.

    Unfortunately, my conclusion was that the only independent character-based terminal tradition is IBM’s 3270 stuff, but even setting aside IBM weirdness it’s simply not that. (Yes, there’s also such a protocol within tmux but it’s not really compatible with anything else.)

  • > It more just argues than tmux is a pita on the terminal ecosystem which I’m sure is true.

    Start thinking of tmux, screen, ssh, etc as terminal emulators, and everything will suddenly make sense.

    > perhaps we should rethink protocols etc to make many of these features more native

    I've been opposing terminal emulators (NOTE: emulators, not REPLs) for a long while. I also do believe we can collectively do better than emulating 1970s hardware. I do believe we can build applications where "ctrl-c" means copy, and selecting more than one screen's worth of text is possible. It's not hard, we're just stubborn.

    • nitpick: ctrl-c never meant copy until windows started to dominate. it didn't even mean that in DOS. selecting more than one screens worth of text is possible in gui terminals and also in tmux.

      but i agree with your general point: we can collectively do better than emulating 1970s hardware

      absolutely!

      6 replies →

  • It's more like you don't need to use a webpage that offers tabs using iframes because the browser natively has tabs that you could be using instead.

  • Having native scroll back should be possible if you hack tmux and a terminal emulator.

  • weztern has a really strong solution in this space when you use it with its multiplexing server on the remote end.

[edit]

The below is fixed (https://github.com/shell-pool/shpool/pull/213/files) upstream already, but is pending a release.

I never heard of shpool, so just tried it. shpool completely breaks my PROMPT_COMMAND because it assumes that each word (in the shell sense) is a separate command. My PROMPT_COMMAND included "history -a" thus causing it to run "history" and "-a" on every prompt, making things quite unusable.

It's quite maddening because all they had to do was write a lot less code to fix it:

    eval "${SHPOOL__OLD_PROMPT_COMMAND}"

Would run the old prompt command just nicely instead of the much longer:

    for prompt_hook in ${SHPOOL__OLD_PROMPT_COMMAND};
    do
        ${prompt_hook};
    done;

I'm by no means a tmux power user, but it does have really nice features for when I need it.

The primary usecase I've had for it is I can kick off 1 or multiple long running jobs, exit, and then come back later and checkout the various stdout logs to see how it worked.

Could I accomplish the same thing with a bunch of stdout pipes, disown, fg, ctrl-z, etc? Sure. However, tmux makes it really easy to do that and then quickly switch around sessions to see how things are going.

In the simplest workflow, it looks like this

    tmux
    longcommand()
    ctrl + B D

and later

    tmux -a

to checkout and see what's gone on with the command long after I disconnected with ssh.

  • I think it's good practice to always start tmux immediately after opening an SSH connection. You might not know a command is long-running until after you start it. And you never know when you connection will just randomly drop. If you're using tmux it's never a big deal when that happens.

    • I think it's notable that when ubuntu runs an upgrade it starts a tmux session for this reason.

The keystrokes are so ingrained into me that you can take tmux from my cold dead hands.

I use it a bit with remote connections, but tmux is basically my IDE for development. I have the backtick mapped as my prefix and I hope between terminals and Neovim, and I am considerably less productive when I don’t have this setup.

  • I use tmux (or screen) as a bag for holding context. I set an environment variable before spawning it, and then key a lot of things in my .bashrc off that environment variable so I get context-specific functions/aliases/vars/etc, and keep them when I open a new window in an existing tmux. The single best part of this is separate histories for my development vs system administration vs whatever, although the rest is still quite useful.

  • Same. I’ve also been semi-forced to learn expect due to abysmally bad UX for how my company handles security (VERY secure, but in the most obtuse way possible), and that’s been a godsend. Not storing anything locally other than metadata, but expect lets me skip the obnoxious manual copy/pasting I would otherwise be doing.

    Sometimes, the old ways are better. A lot of times, actually.

> Further, I'm slowly noticing things that tmux didn't handle well, but now, "just work": native scrollback, terminal notifications, and terminal titles being the most notable changes.

You can make tmux's OS window title and its internal window titles be whatever you want:

Add "set -g set-titles" to ~/.tmux.conf. To test without changing the config, type `^B : set -g set-titles`, and to restore it back to default, `^B : set -gu set-titles`. This will be useful but overly verbose. It can be configured further. For example, `set -g set-titles-string "tmux | #{pane_title}"` will make it contain the title set by the shell (for PS1, I just make it set the current directory with `\w` or `\W`).

Then, to make tmux's window titles (so, what will show up in the "window list") also be named after the current directory, you can use `set -g automatic-rename-format "#{pane_title}"`.

Switching to WezTerm has completely eliminated the need for tmux for me - except for stuff I want to run server side, disconnect and come back to.

  • Maybe I'm a bit weird, but I don't know why you'd want to run tmux locally as an alternative to using tiling wm/tabs/other equivalent feature of your terminal emulator? I use tmux in two ways: 1. Persistent long-running sessions (which typically involve having more than one tty going at once, so something like shpool seems like a downgrade). 2. Local named-network-namespace sessions where I'm connected to a VPN and so not having to reconnect to the same namespace/vpn for every new tty is a benefit.

    Also, if you do physically connect to a headless machine, it's nice to not need to keep having to open a new getty session (or be able to log out of a session) ;)

    • i have 5 tmux sessions with a total of 19 windows on my laptop, one of which contains a localhost ssh connection to a second account where i have another tmux session with half a dozen windows. not to mention the tmux sessions i have on my servers.

      the key benefit is i only need to learn one set of commands to switch sessions and windows, and to create new windows.

      the sessions all run in a single terminal window, so when i have multiple other windows, i don't have to switch between them to find the right terminal window. terminals have tabs, but they don't group tabs into sessions. a single terminal with 19 tabs would not work.

      i use the gui to start the terminal. i would have to find out how to script starting a terminal with multiple tabs. tmux is more easily scriptable, and again, i can't avoid learning tmux, since i use it remotely, and so when using it locally too, i don't have to learn a different way for my local machine.

      finally, although rarely needed, i can log out, or my gui can crash, but the tmux sessions survive. i can also connect to my laptop from a different device and attach to the tmux sessions that way.

      for a gui terminal to replace tmux the foremost feature i need is for it to remember my windows and tabs, just like the browser does. i have not come across any terminal that does that (but i admit, i haven't done a exhaustive search either). gnome (or any WM) can remember which apps i have open, but it can't remember the state inside the apps.

      being able to reproduce state is really the key. i have a few vim sessions for example, easily remembered and recalled from my command line history. i could use gvim if i could figure out how to connect a gvim window with a terminal such that they form one unit, because every vim session is connected a number of commandline operations. (i believe BeOS/haiku can potentially do that based on the way its window tabs work)

      2 replies →

    • Two reasons:

      I don't use a tiling WM, and tmux[1] does an excellent job at the tiling features.

      I do the majority of my work physically at a Linux (Fedora) desktop, but I also work from home SSH'd to that desktop. Being able to just attach to the same session and pick up where I left off, with all the same shell management, is great.

      [1] I used tmux for years, but have very recently switched to Zellij. I find the pane navigation to be much smoother (and more discoverable).

  • same, and those 2 plugins together completely eliminated need for tmux/zelij locally

    - https://github.com/MLFlexer/smart_workspace_switcher.wezterm

    - https://github.com/MLFlexer/resurrect.wezterm

    • These seem nice but honestly feel like overkill for the most basic (and probably most typical?) use of tmux and similar.

      I generally have a single session I care about per machine (rather than per project) and wezterm's built-in multiplexing handles this out of the box.

  • I agree. I've used first Kitty and more recently WezTerm (and now occasionally Ghostty, too) for years and every time I've tried tmux/zellij I've found nothing (except as you say for occasional long running server sessions) in either that justifies the noticable latency increase for me.

  • `wezterm ssh` can do this if wezterm is installed on the host.

    • Yeah - it seems like this is a pretty undersold feature of WezTerm. It has completely eliminated tmux and Zellij for me outside of pairing with others.

From what I have seen, tmux is the _only_ multiplexer with with you can select from the scroll-back buffer using only the keyboard (without using the mouse).

  • Absolutely! You also have full control over the history size, along with powerful search capabilities. You can move panes and windows seamlessly across sessions, and even share those sessions with other users. My yank script integrates with tmux buffers, so copy/paste works flawlessly, even in vertical splits. I strongly disagree with the article; I simply can’t imagine using a terminal without tmux.

It's a bit unclear what the limitations of the non-screen/tmux alternatives are E.g. how does the scrollback work if I were to disconnect and then reconnect with a different machine, can I view the scrollback like screen/tmux?

It's also nice to be able to re-connect and be able to resume a session without having to reopen many terminals, which you would lose with the lack of window management.

Obviously, different ways for different folks -- I never got into tmux, but perhaps relatedly, what I want is a well thought out and stable terminal/GUI filemanager hybrid thing; e.g. I can either "cd" or just click where I want to go, etc. I've seen half done implementations of this but nothing comprehensive?

  • What would happen when you click on a directory (I’m assuming you’re imagining a directory tree on the side in a separate pane) while some CLI program is running? Run the corresponding cd when the program exits and returns to the shell?

    • Yes, but I'm imagining that this isn't something that works in conjunction with another terminal program, but that it's one program -- some kind of shell/GUI hybrid.

      I have actually seen this before, in the very fun but silly and not-particularly-useful edex-ui thing. (great way to impress people who don't know, but like, if you type your password in it it literally shows the keystrokes)

      https://github.com/GitSquared/edex-ui

I don't need much. I tried zellij but i couldn't stick with it. I either had to lock/unlock or change keybinds which is also annoying. Now i use ghostty and i can create new splits, tabs and i know few shortcuts to move around and resize and that's it.

My fingers are just too used to tmux and I can do all I want to do. But I hear the scroll issue. When I have to copy multiple chunks, I have to go to cp mode visual a chunk and as soon as I enter tmux goes to the bottom line and I have to scroll up again…

I keep using GNU Screen

    * Scrolling on TTY (Linux itself doesn’t support this for some years)
    * Window-Tabs on TTY, Wayland, SSH
    * Sessions
    * Copy/Paste

I’m not using ZelliJ or Tmux because I don’t need more features and I know the shortcuts. I’m fine and don’t need weird workarounds. This article even confirms my decision!

Would love some good C developers helping the Screen people.

Tmux has definitely caused me some pain too. I'm mostly back now (semi alas) but for a while I was using shpool adjacent dtach to leave nvim sessions running even if I logout. If I was doing things on the terminal, it would be inside an nvim terminal window.

My workflow is project oriented, and I have to juggle multiple projects. So I wrote a small script to let me quickly either attach to an existing dtach session for a project by name, or to start a dtach+nvim session for a project.

Also included some fun wildcarding, so I didn't have to type the full name of the project out, could just type some letters and hit enter.

https://github.com/jauntywunderkind/dtachment

I don't see change as likely, but it does strike me as absurd that although I had gotten rid of tmux as a redundant window management system, I still had both the OS and nvim's window management going. The author talks about how things would work over ssh, but ideally to me, I could ssh in, forward some ports, and start some new terminal emulators that open multiple nvim clients that attach to a persistent perhaps headless nvim session.

I need "tmux" on remote linux machines that don't allow me to install "screen". If there's an easier way to keep a session running (and interactive) over internet disconnects, I have not found it yet

  • If you can't install screen then I'm surprised you can install tmux - BUT if you can install wezterm then it solves this need nicely by adding sessions + multiplexing to the terminal emulator itself.

    https://wezterm.org/multiplexing.html

    • tmux is probably already there (ubuntu always includes it), wezterm won't be. If I need to connect to a random machine, I first try tmux, then byobu, then screen. If one of those is not there it's most likely a fairly weak machine and so it's unlikely that anything can be installed on it.

If I were to stop using tmux, the things I would need to replace are:

1. zoom-pane (temporarily make one pane be the only pane) (also can someone please add this to vscode!)

2. keybindings to navigate focus between panes according to their layout positions

3. ability for another process to programmatically change which terminal window has focus, and window naming

I think that's it. Could probably hack most/all of that together with hammerspoon I guess. I don't use it for persistence, and I certainly don't like the scrollback UX. It has got in the way from time to time, principally with its slow adoption of hyperlinks. But I'm general it's been a huge win for years.

Don't use tmux. Use a nice wrapper for tmux instead (e.g. like byobu).

Otherwise complaining about tmux and talking about hacky workaround alternatives is a bit like complaining about the internet and advocating for the telegraph as a hacky alternative because you don't like writing your own HTTP requests by hand and morse code is so much simpler.

Having said that, if really all you want is pane splits / window management, lots of terminals have their own solutions for this. Guake is a good one.

disclaimer: I use Guake and still prefer to just use tmux (byobu) from Guake

  • does guake support multiple sessions? remembering window layout through restart? or easily configurable startup layout?

Zellij has started to become messy in my setup (i don't mean to blame zellij, i just suck), so I'm looking into tmux now.

I liked the fact I didn't need to set anything up for Zellij and could gradually add stuff

  • I gave Zellij a shot a few months ago. It really felt too "modal" for me though. I've been a Vim user forever so I'm not exactly modal-averse. But TMUX has always felt more like Operator Pending mode in Vim. Having Zellij feel like full-on Normal mode was frustrating. After I gave up, someone told me they had their Zellij configured just like TMUX, and I should give it another shot with their config. I still haven't gotten around to it.

    • Zellij has added a "locked" mode (defaults to Ctrl + g) where it acts just like Vim's normal/insert modes. So when to do mux commands you unlock it first.

    • could you share that config please? as a tmux user i feel like i might run into the same problems, and so a tmux like setup might be a good start.

The conclusion I come to from this is that yes, I actually do need tmux, as the alternatives proposed are far more annoying and provide no benefit. I don't have a need for graphics in the terminal, and frankly I find it odd that we wouldn't simply display graphics... with the graphics system. But I do have a need for seamless session persistence and multiple terminals, and I do enjoy splitting a window when I'm running a command on multiple servers.

I just browsed through to realize that this is not criticism to tmux very existence. It’s just author found his own ways. That’s OK. I was once screen user, tmux extends that, but comes with emacs keyboard combos like if I was doing Mortal Kombat fatality trick for a simple thing and I personally found zellij more user friendly to me, unless I launch my linux box with i3 where all that is basically replaced by a quite interesting compositor. Point is… there are many ways to solve a problem… finding one that works for an individual doesn’t automatically create religious dogma… unless one wants to be internet famous for 72h and then forgotten until another dopamine shot hits.

If you're using kitty and have terminal related problems the easiest solution usually is just not using kitty.

> act as a drag on the ecosystem as a whole, making it very hard to get any new features

I dont see this as an issue though. Terminals are pretty much a solved problem, they dont need any new features. IMO it makes more sense to spend effort on improving tmux<->terminal interop rather than adding fancy graphics protocols that we dont actually need.

  • it's not fancy graphics that's missing from the terminal. but things like selection of text areas. (you can only select across the whole screen now, and if you are lucky you can select rectangles. but if i display text in multiple columns i'd like to be able to select one column at a time for example. this bites me every time when i use tmux or vim split windows. also filesystem navigation could be improved, multiline commandline editing is sorely lacking. fish tried that, but failed to make it work. clearly a limitation of the terminal.

    so no, terminals are not a solved problem.

Session persistence is the key feature for me. All the rest I don't need because i simply open more windows. However multiple windows (or whatever you call them) were really useful when I bought a vt100 as a teenager and programmed on that for a while for fun (with screen at the time, not tmux).

Yes the clean and efficient alternative would be a session manager "server" running on the server and communicating with the terminal "client" (like kitty) using a more efficient protocol for handling panes/windows/drawing etc...

AFAIK this doesn't exist, so I'm using tmux...

People here are missing the point of the solution described in the blog post.

This isn't about reinventing tmux poorly. They're trying to keep their workflow without having a muxer in the middle that needs to understand and translate every feature of the protocol, which is the core concept and the major problem with tmux.

If you do splits client side, you don't have any software middlebox trying to interpret the traffic, so you keep native scrollback and all the fancy features of your terminal are still here.

That's what the blog post is about. Not reinventing tmux, but getting rid of the muxing.

  • In the Youtube interview with Goyal linked in the post, he explained this well. He said he contemplated developing another approach for this if he found time, where the multiplexer communicated with the terminal differently. Hope he gets to work on it.

    • I recommend the interview, it's very good. It should be available in podcast form as well. The Kitty author comes across very well in the interview

I host a Minecraft server at my house; tmux is great for this:

1. Log in to the physical server.

2. Start a named tmux session.

3. Run the Minecraft start script (log messages start populating)

4. Ctrl + b ... d

Now, whenever I need to do something with the server, I just attach back to the session and do it.

I highly recommend zellij if you’re looking for a newer multiplexer. It give a bunch of tmux features but without some of the legacy baggage.

I don't use tmux because I have to. I use it because I love the way it works. The issues the author of the article and Kovid Goyal raise are not issues for me in practice. If something is built that better suits my needs, I'll be happy to switch. I am particularly sympathetic to Goyal's gripes about the performance/resource wastes of a multiplexer.

But I also take issue with statements like "terminal multiplexers are a bad idea, do not use them, if at all possible" (from the kitty FAQ and the YouTube video linked in the article). Tmux solves a number of real problems for me that Kitty doesn't. Kitty also seems to be moving in a direction that I am not interested in. It's tied to a windowing system when I want a terminal that I can use headless. Even with the hacky workarounds the article mentions, it doesn't really support session persistence when I use this feature of tmux weekly. It introduces a lot of features that are likely to lead to visual noise when the constraints of text-only are one of the main reasons I like terminals (personally I don't want images in my terminal, full stop).

Now, all of this is fine. It's the other statement, "[tmux acts] as a drag on the ecosystem as a whole, making it very hard to get any new features," that causes it all to rub me the wrong way. The only reason you feel like tmux acts like a drag is because there are users like me who won't switch to something like Kitty if it doesn't support tmux. So don't worry about us. Build a new thing that is not backwards compatible and live with the fact that many people won't use it. If you really want to drive the ecosystem forward as a whole, be less condescending about real use-cases that bring benefit to real users.

To be clear (because text is a limited medium), I'm not grumpy, angry, or against Kitty because of this. But I am dismissive.

I think a key piece of context to Kovid's distain of tmux is how good window management is in kitty. I regularly have at least ten terminals open and navigating them is a breeze. I previously lived in tmux but much prefer this.

The session persistence thing is still best solved with tmux, however, I don't ever need this. Nohup is sufficient for long running commands where my ssh might fail. I don't really find myself sshing into a machine and then setting loads of env vars that I need to persist.

  • i tried using kitty a year ago. i was not impressed: https://news.ycombinator.com/item?id=40478732

    kovid is talking about how tmux gets in the way of terminals adding new features. i agree with that, but what about the features that tmux offers that i have yet to see in any gui terminal. (multiple sessions. the ability to connect to the same session from multiple terminals. scriptability, including sending characters into a terminal. splitting windows into multiple panes...)

    can kitty do any of those? if you want to add features to the terminal, then you have to content that tmux does as well, and maybe tmux features are more interesting to me than kittys. so if you want to win me over, then you have to actually implement some of the features of tmux that i use.

    (watching the interview, it looks like kitty does indeed implement some of tmux features, because interestingly the interviewer asks just the right questions. but i need to look for a more comprehensive introduction to see how kitty can replace tmux locally.)

  • More generally I use a tiling window manager which is already doing pane/tab layout for me, but doing that with every window I have, so I don't really want tmux acting as a separate window manager just for shells.

  • For long running sessions I think screen is better... `nohup cmd &` is finnicky and I don't trust it to work on every software. I think `screen -S foo` and `screen -r foo` is much more ergonomic. No pipe to file, no disowned pid.

I stopped using tmux, but not for the reasons mentioned here. I think tmux is perfectly fine, I just don't like the default keybindings and I could never remember how to copy/paste between windows.

I've switched to abduco for persistance and use neovim for window management (both vim and neovim have a built in terminal emulator). Using vim keybindings for managing windows and tabs is more natural, I can copy/paster just normally and you even get some perks like `gf` to quickly open a filepath under the cursor.

  • is the vim terminal support that good now? i remember it being brittle. some apps, especially apps that use the full terminal window didn't run well inside the vim terminal.

    • The neovim terminal is pretty decent, the only feature I miss is reflowing the text on resize. I haven't used the vim one extensively, but I've heard it may even better than the neovim one.

All good points relating to friction points with tmux.

But, I am not an uber-elite-geek and Zellij is a good enough compromise to me.

It gives me the things I am too lazy to solve by myself like tmux, with a lot less pain points.

I only use tmux for one reason -- for a script that setups my local server and runs backend/frontend/etc

If there's a better way, I'm open to it. As of right now Claude can't vibe code me a script that opens two ghostty tabs, so tmux it is

I’ve migrated from tmux to zellij. And I’m playing around with omarchy and am really digging the tiling window manager feature

Sounds like work-arounds and duck-tape-tier re-implementation of tmux features, to be honest.

I'm still a gnu screen guy, but for me the trade-off is still in favour of screen/tmux.

Honestly, my only gripes with TMUX have been:

1. Having to zoom a window before copying multiple lines of text (Kovid brought this up in the interview that was mentioned in this article)

2. The weirdness of copying text from the scrollback buffer into the clipboard

I've tried so many things for the second one over the years. I think I have it working okay-ish these days. But there are still plenty of times that I say, "aw screw it", and literally use the terminal's copy command.

Every other solution to my multi-terminal workflow have been worse though! i3/bspwm with multiple terminals were okay. It was just hard to have "projects". I'd have to visit each terminal and switch to the proper directory, launch servers/docker-compose/etc.

Zellij felt like too much "hopping out into manipulation mode, manipulating, then hopping back into work mode". Those milleseconds were enough to halt my flowstate.

Single terminal with built-in tabs/splits felt clunky as I couldn't get the keyboard shortcuts into muscle memory (perhaps more time would help)

> "You might not need tmux"

First step, reimplementing the (arguably) one essential thing tmux provides, i.e., persistence: all tools have "varying degrees of success" and "are buggy". Scrollback? In tmux you "have to learn the tmux way", with the alternatives you might have it if you're lucky.

I went into the post with an open mind but I don't think I will be ditching tmux anytime soon...

Tmux prevents vendor lock-in but on Terminal level. It's so established and standard that everyone knows they need to support it, which is great. I don't need my terminal do display pictures, render video or whatever crazy features they come up with next, I want a solid base with the essentials.

The rest the Operating system applications can probably do better anyway. VLC, MPV, Apple Preview IrfanView etc.

That's why I love Alacritty, no fuss, no overcomplication. The basics, fast and stable.

I love tmux in combination with tmuxinator. Because with one command I can start my dev setup with one split for nvim, one for lazygit, one for yazi and one for claude code. In another window I can run the server, in another I can tail the logfiles.

I have similar setups for various projetcts and do not need to manually start services, tools, whatnot. With `mx projectx` everything is started within seconds.

And navigating panes and windows is super easy with the proper shortcuts (opt+h,j,k,l), even across tmux and nvim.

Why would I give up on that?

  • Thanks for the link to tmuxinator, I had heard of it but never learned what it does. I think I'd like something like this. But I think this is a case of tmux providing a platform, I think the core idea of tmuxinator could be implemented outside of tmux, so tmux in that regard is basically an implementation detail.

    Then it is a pragmatic decision, using tmux you get to use the ecosystem of things like tmuxinator which explicitly target tmux to get a known number of terminal features like splits. What I learn from the OP, is that there are technical reasons that tmux is not a "good design" - like Kovid's comments on how it constrains innovation in terminal designs - which might lead someone to consider, what actually does tmux do and could my workflow be implemented otherwise?

    It might be a bunch of unixy hacks and tricks (as another commenter here said) but it can work. I'd imagine recreating something like tmuxinator would be hard though, but it could also be interesting, like having arbitrary GUI programs configured to appear in "splits" using tiling integrated seamlessly within the terminals. But yeah, if the workflow is already set up and serviceable and supported with a community, using tmux, then I'd just keep using it.

If your main issue is session persistance you should try using mosh

  • mosh doesn't allow you to reconnect to an old session if you restart the client or connect with a different one. tmux/screen do.

Reminder: terminal multiplexers (like TMUX, Zellij, and Screen) are terminals too — even if often overlooked as such.

So, if your multiplexer lacks support for certain features, it will limit functionality in advanced terminals like Kitty or Ghostty.

TMUX supports sixels just fine. It's a damn standard, and you have it at OpenBSD's base. Keep It Simple, Stupid.

Also, tmux new-window does wonders with software spawned from sfeed, sacc and who knows how many TUI/CLI tools.

You open your RSS feed list with sfeed, read the whole page with C under 'less', and if there are images, you can spawn Links in another page with 'o'.

If I could just figure out how to scrollback in ghostty I probably wouldn’t bother with tmux.

Are you serious?

Press "<Enter>~." into your ssh window.

Do you think ssh isn't interpreting escape codes either for some reason?

I was in the same boat then I discovered this thing called a GUI and inside this GUI I could use this thing called tabs. It was revolutionary technology.

It’s just too bad I suffer from a lack of common sense and insistence on trying to believe that all archaic terminal text based tools are better than anything else. I’m a developer and developers have insight on the best UI and we know that terminals are better than anything in the known universe. If you use a mouse you’re an ass hole.

  • I too also don't understand other people's workflows but believe I know the best way to interact with a computer.

    • Agreed. Stupid people with stupid opinions don’t exist. Everyone’s opinion is valid. We must be inclusive of people with bad and wrong ideas. All criticism is wrong because saying someone’s workflow isn’t good will hurt their feelings.

      Useful debate on the merits of anything is a pointless endeavor because all varying opinions are valid. There is no best, better or worse… just everyone’s freedom of opinions.

      In my opinion eating lead is good for you and using a mouse and clicking on tabs hinders my efficiency by 300 percent. That’s my opinion! And it’s valid! I am valid!

  • not appreciating the snark. tmux does way more than being an alternative way to get tabs.

    • Ok. No snark. Sessions, tabs, windows, tiling . All done in GUIs and done better.

      Tmux is good when you have no gui.

      But all this endless getting square pegs to fit in a round hole is what causes the snarks. Like you want to draw windows? Let’s use terminal characters instead of lines! Makes perfect sense.

      I find it incredulous that a lecture had to get this guy to realize what’s wrong with tmux and he still doesn’t see that this problem can be avoided by using a gui. He still goes for terminal abstractions.

      GUI is an obvious solution. But this guy is blind.

      7 replies →