News for hackers. Stuff that matters.
Re:You might not need tmux by jelder on Friday August 01, 2025 @07:01AM (#44755212)
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.
Re:You might not need tmux by mike-cardwell on Friday August 01, 2025 @07:14AM (#44755297)
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
Re:You might not need tmux by ghkbrew on Friday August 01, 2025 @01:55PM (#44760101)
Mosh looks very cool, though I've never used it. Does Screen provide some advantage over tmux in this setup?
Re:You might not need tmux by jvanderbot on Friday August 01, 2025 @03:14PM (#44761124)
Yes. Mosh is a seamless replacement for ssh, and screen is a mostly seamless replacement for tmux. One more level is Mosh+byobu, which is so useful I don't even bother with plain terminals most the time.
Re:You might not need tmux by positr0n on Friday August 01, 2025 @03:22PM (#44761225)
Haha I think you have the history backwards here. Tmux was created as a replacement for screen when it was 20 years old! Speaking as someone with ‘set -g prefix c-a’ in their .tmux.conf because my muscle memory is so used to the screen hotkeys.

GNU screen was released in 1987.

tmux was created in 2007.

Re:You might not need tmux by jvanderbot on Friday August 01, 2025 @09:07PM (#44764117)
Hey maybe I do! Great to learn the history here. Regardless, my point is that Byobu is very nice compared to either. That may now be lost due to my careless comment.
Re:You might not need tmux by saagarjha on Saturday August 02, 2025 @05:12AM (#44765934)
It's seamless until you want to scroll.
Re:You might not need tmux by lostdog on Friday August 01, 2025 @05:51PM (#44762868)
Mosh does not support OSC52, so it's a barrier to getting copy/paste to work.
Re:You might not need tmux by kzrdude on Friday August 01, 2025 @07:37PM (#44763587)
And case in point, mosh is another terminal layer, it's also a multiplexer of sorts.

I've used mosh a lot but it's just interesting to note it's in the same category as screen and tmux

Re:You might not need tmux by brontitall on Friday August 01, 2025 @06:16PM (#44763068)
On mobile so I’m not sure which case OSC52 applies to, but I use mosh+tmux 8-10 hours a day. Both bracketed paste and tmux selection setting local clipboard work fine
Re:You might not need tmux by attentive on Saturday August 02, 2025 @03:54AM (#44765610)
it sort of does support it, except it doesn't work with tmux.
Re:You might not need tmux by radiofreeeuropa on Friday August 01, 2025 @06:04PM (#44762957)
Mosh is excellent. It lets remote sessions survive (well, automatically and transparently recover from) disruption that reliably kills ssh.

I basically don't use ssh at all any more for interactive sessions, because I'm sick of a few lost packets on wifi or a weak cell signal dropping my connections and forcing me to start over.

Tmux, I used to use and eventually abandoned. I decided I didn't need two keyboard-based window managers (I use Spectacle on Mac) and the one that was only for shells was the one that could go. I have replaced it with nothing, so far, aside from that I just open more Terminal.app windows now (I also used to use iTerm2, for years, until it dawned on me that I was using exactly nothing in it that's not also provided by Terminal.app, and the latter's got better input latency, so I was suffering an extra installed program and slightly less responsive typing for no reason at all)

Re:You might not need tmux by nyarlathotep_ on Friday August 01, 2025 @07:07PM (#44763426)
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.

Re:You might not need tmux by anthk on Saturday August 02, 2025 @03:03AM (#44765396)
I used mosh when my data plan plumetted to 2.7 KBPS (~ISDN/2G speeds).

I connected to a public Unix server and read news, IRC'ed, IM'ed and such like crazy. Also, without being connected to a Pubnix, IRC and Gopher did it fine, the web with patience, and the same with Gemini (gemini://gemi.dev has been really useful to read news and scrap a 95% of unneeded scripts and trackers from web sites).

Usenet was slow on fetching, but totally readable the next morning, and, better, offline.

Re:You might not need tmux by sintax on Saturday August 02, 2025 @09:20AM (#44767385)
Other options for resumable sessions: tmux/screen + https://eternalterminal.dev/ or https://wezterm.org/ which can resume open windows like you get with iTerm2+tmux.
Re:You might not need tmux by crtasm on Friday August 01, 2025 @07:30AM (#44755381)
Then a nice addition is to save typing it each time

  alias looptmux='while true; do ssh tmux; sleep 2; done'
Re:You might not need tmux by nolist_policy on Friday August 01, 2025 @10:37AM (#44757429)
Better:

  autossh -M0 tmux
Re:You might not need tmux by suslik on Friday August 01, 2025 @07:09AM (#44755268)
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.
Re:You might not need tmux by antonvs on Friday August 01, 2025 @10:26AM (#44757284)
> falling back to screen

So you're saying you're a masochist

Re:You might not need tmux by hdgvhicv on Saturday August 02, 2025 @03:32AM (#44765520)
I’ve used screen for 25 years. What am I missing without tmux?
Re:You might not need tmux by em-bee on Saturday August 02, 2025 @09:06AM (#44767284)
mainly sessions, i think, and maybe scripability. sessions are groups of windows. i have one session per project or work mode. (one for email and connecting to remote machines, one for writing stuff, one for managing my hobbies, one for dev work...)
Re:You might not need tmux by nothrabannosir on Saturday August 02, 2025 @12:03PM (#44768716)
Screen has sessions. You can name them, and choose which session to resume when you reconnect.

I use tmux now because it’s supposed to be cool but secretly like gp I also wonder what the actual difference is , besides a different default leader key. Oh and killer iterm2 integration.

Re:You might not need tmux by em-bee on Saturday August 02, 2025 @04:17PM (#44771031)
it's been a long time since i used screen. afaik screen had one session per process. you could switch processes by detaching from one and attaching to another. in tmux it's all one process, which allows you to create new sessions and switch them interactively and move windows from one session to another, or even have a window in more than one session. i can also see all windows from all sessions:

    (0)   - main: 6 windows
    (1)   ├─> 0: elvish-
    (2)   ├─> 1: elvish*: "[mosh] embee@foo:~"
    (3)   ├─> 2: elvish
    (4)   ├─> 3: elvish: "embee@bar:~"
    (5)   ├─> 4: elvish: "[mosh] embee@fedora:/etc"
    (6)   └─> 5: elvish
    (7)   - local: 6 windows (attached)
    (8)   ├─> 0: elvish
    (9)   ├─> 1: elvish-
    (M-a) ├─> 2: [tmux]*
    (M-b) ├─> 3: elvish
    (M-c) ├─> 4: elvish
    (M-d) └─> 5: elvish
    (M-e) - dev: 7 windows (attached)
    (M-f) ├─> 0: elvish*
    (M-g) ├─> 1: elvish-
    (M-h) ├─> 2: elvish
    (M-i) ├─> 3: elvish
    (M-j) ├─> 4: elvish
Re:You might not need tmux by nolist_policy on Friday August 01, 2025 @10:36AM (#44757413)
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
Re:You might not need tmux by fouc on Friday August 01, 2025 @12:54PM (#44759362)
I've always found screen's ctrl-a is so much easier to reach for than tmux's ctrl-b. I recommend re-mapping ctrl-b to ctrl-a
Re:You might not need tmux by __david__ on Friday August 01, 2025 @03:29PM (#44761318)
Both C-a and C-b are so commonly used that I don’t like either of them. I ended up going with C-\ since I only rarely use that one.
Re:You might not need tmux by _kst_ on Friday August 01, 2025 @01:57PM (#44760128)
I use Ctrl-Space.

    unbind-key C-b
    set -g prefix C-Space
    bind-key C-Space send-prefix
I find it a lot easier to type than either Ctrl-A or Ctrl-B.
Re:You might not need tmux by cyberpunk on Friday August 01, 2025 @04:18PM (#44761983)
The real superpower prefix key is ` especially if you have a british mac keyboard.
Re:You might not need tmux by anthk on Friday August 01, 2025 @04:33PM (#44762163)
I just remapped the keys to ctrl-z after I swapped ctrl and caps lock. As you'd never suspend stuff under tmux for obvious reasons, you'll get the whole keyset for any cli/tui software.
Re:You might not need tmux by rcakebread on Friday August 01, 2025 @05:02PM (#44762457)
I'll bite. What's so obvious? I suspend jobs in bash all the time while using tmux.
Re:You might not need tmux by anthk on Friday August 01, 2025 @05:35PM (#44762753)
Often TMUX it's for tasks you woudn't suspend. And, if any, you can just use kill -STOP and kill -CONT among other signals from another tmux pane.
Re:You might not need tmux by fireflash38 on Saturday August 02, 2025 @07:47AM (#44766842)
Or if you want to stay in same pane, (chord, I still use C-b), :, "send-keys C-z"
Re:You might not need tmux by fouc on Tuesday August 05, 2025 @01:36AM (#44794640)
pinky on caps and ring finger on z ?
Re:You might not need tmux by crabsand on Monday August 11, 2025 @01:47PM (#44867157)
+1. Was using screen with this and now tmux for the last 15 years maybe.
Re:You might not need tmux by ornornor on Wednesday August 13, 2025 @02:07AM (#44885104)
I use tmux to replace terminal emulator tabs, I also suspend jobs all the time (most notably vim to run git commands)

In any case with your bindings you can still C-z z and it sends C-z to the process.

Re:You might not need tmux by saagarjha on Saturday August 02, 2025 @05:13AM (#44765942)
I never really understood the people who use these keybinds. Do you not use it to go to the start of the line?
Re:You might not need tmux by scuderiaseb on Saturday August 02, 2025 @06:05AM (#44766247)
Personally no, I use vim keybindings in the terminal not emacs which is the default.
Re:You might not need tmux by Biganon on Saturday August 02, 2025 @06:28AM (#44766380)
Ctrl-a and then a still goes to the start of the line.
Re:You might not need tmux by benreesman on Saturday August 02, 2025 @05:38AM (#44766067)
I've had it on C-o forever to mostly stay out of readline's way, but I've been dabbling with C-Space.
Re:You might not need tmux by aargh_aargh on Friday August 01, 2025 @08:27AM (#44755777)
Does any Linux terminal have a comparable integration? I'm still using GNU Screen but willing to give tmux another shot.
Re:You might not need tmux by felixding on Friday August 01, 2025 @11:59AM (#44758698)
WezTerm

The author of this feature also ported it to the Windows Terminal.

Besides, Chrome OS’s built in terminal also has tmux integration.

Re:You might not need tmux by natebc on Friday August 01, 2025 @12:57PM (#44759389)
Do you have links to any examples? I've searched for this on and off for years, and i use Wezterm, but i've never been able to make it work like i remember the iTerm2 integration working.

Would love for examples using Windows Terminal as well.

Re:You might not need tmux by saagarjha on Saturday August 02, 2025 @05:13AM (#44765947)
I downloaded it to try it and it basically worked out of the box. What did you try?
Re:You might not need tmux by lostmsu on Tuesday August 05, 2025 @11:07AM (#44798964)
Wait, how do you use it with Windows terminal? Same SSH config?
Re:You might not need tmux by lostmsu on Friday August 08, 2025 @01:31PM (#44839565)
In fact, Windows Terminal has an open issue for the CC mode: https://github.com/microsoft/terminal/issues/3656
Re:You might not need tmux by edoceo on Friday August 01, 2025 @11:49AM (#44758585)
There was one called Terminator which had some tmux like features, split panes, broadcast, etc. It's not been maintained in a bit.

https://gnome-terminator.org/

Re:You might not need tmux by rhesa on Friday August 01, 2025 @02:12PM (#44760364)
I used to use terminator for a long time, but i've switched to tilix (https://gnunn1.github.io/tilix-web/) with little pain.
Re:You might not need tmux by edoceo on Friday August 01, 2025 @08:21PM (#44763854)
I'll check it out.

Note: that Terminator I linked is a re-boot (I'll be back) so, I might give it another go as well.

Re:You might not need tmux by quaddo on Saturday August 02, 2025 @06:44PM (#44772317)
I was a huge tilix fan for ages, but ran into an issue with long URLs being unclickable.
Re:You might not need tmux by dizhn on Friday August 01, 2025 @10:05AM (#44757044)
wezterm
Re:You might not need tmux by cpuguy83 on Friday August 01, 2025 @10:03AM (#44757020)
Pretty sure iTerm is the only term that implements that tmux protocol.
Re:You might not need tmux by tristan957 on Friday August 01, 2025 @02:34PM (#44760642)
Ghostty has infrastructure to support it from my understanding, like Mitchell did the initial plumbing. It just takes a spirited individual to finish it up.
Re:You might not need tmux by kzrdude on Friday August 01, 2025 @07:39PM (#44763605)
ITerm2 seems really cool, it has so many features. The developer(s?) must be really productive, they churn it out. They support a lot of Kitty protocols for example.
Re:You might not need tmux by ho_schi on Friday August 01, 2025 @01:59PM (#44760172)
I use happily GNU Screen. Keep it?
Re:You might not need tmux by scelerat on Friday August 01, 2025 @11:22AM (#44758178)
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.

Re:You might not need tmux by quesera on Friday August 01, 2025 @07:27PM (#44763536)
> 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?

Re:You might not need tmux by scelerat on Monday August 04, 2025 @06:38PM (#44792118)
I could never get italics to work correctly when in iTerm2/tmux mode. Pure tmux, yes, iTerm no tmux yes, iTerm+tmux I would get weird background colors instead of italics. It's been a while so I don't remember specifics
Re:You might not need tmux by op00to on Friday August 01, 2025 @12:27PM (#44759061)
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.
Re:You might not need tmux by paradox460 on Friday August 01, 2025 @12:50PM (#44759319)
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
Re:You might not need tmux by op00to on Saturday August 02, 2025 @10:53AM (#44768095)
Bummer!
Re:You might not need tmux by alexozer on Friday August 01, 2025 @03:37PM (#44761410)
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.

Re:You might not need tmux by gorjusborg on Friday August 01, 2025 @06:12PM (#44763037)
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.

Re:You might not need tmux by jayknight on Friday August 01, 2025 @04:54PM (#44762379)
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.

Re:You might not need tmux by sigwinch on Friday August 01, 2025 @10:52PM (#44764547)
You might not need control mode for that, try `autossh foo ‘tmux new-session -A’`
Re:You might not need tmux by saghm on Saturday August 02, 2025 @02:22AM (#44765246)
As someone who uses Linux on all my personal machines but has usually had to use a MacBook for work, tmux is also pretty useful as a platform- independent tool for me to reuse the same workflow without needing to worry about differences between the two. I use Alacritty on Linux, but when I've tried using it on MacOS, there have things that don't seem to work for me out of the box the same way they do in Linux (which I'm struggling to remember exactly at the moment, but I think one of them might have been the setting to have the window maximized on startup). Rather than spend time trying to tinker around on an operating system that I don't have any particular desire to use outside of just getting my work done, it's pretty nice to be able to use tmux on iTerm to get basically the same experience I do on Linux. From that perspective, having something like an entirely independent way of scrolling back in a session is a feature to me, not an annoyance.

A lot of these arguments against tmux seem like they're more relevant to someone developing a terminal rather than using it. It's fine for people working on their own terminals to decide they don't care to support it, but I don't really find the arguments convincing as something I should care about, and I'd personally just switch to another terminal with better support for it rather than stop using it.