Live data from Hacker News

Getting Started with Tmux

ittavern.com

41–50 of 160 posts

Re: Getting Started with Tmux

#42
post #29

My favorite antipattern is, you can just leave a script that does an event loop running in the foreground, detatch tmux, and voila, you have a 'server'. Works great in a pinch or when you just don't need to finish it.

+1 Been running my servers this way, for years.

I've only recently started running my servers this way, and I've taken this to the next level with bubblewrap: https://tobykurien.com/simpler-linux-selfhosting/

Re: Getting Started with Tmux

#43
I've used Tmux/Screen the few times I've had to be in an actual terminal, but don't really see the use for them when using a GUI terminal emulator. I just open new tabs or (rarely) windows as needed.

Could anyone using these explain what it provides that you find useful in practice? I rarely ever need persistence of shell when I close the console, is that a common need? Familiarity/muscle memory of shortcuts is a valid answer, but I'm wondering if there's more to it than that.

Re: Getting Started with Tmux

#45

As a heavy GNU Screen user for the last 2 decades it’s always in the back of my mind if I should be switching to tmux. Maybe there is a compatibility mode. For those who switched from screen what was the biggest benefit?

For me it was that tmux worked out of the box the way I spent many hours getting screen to work the way I wanted. And then from there, just in general the docs were better, it was updated more often, and in general was a bit less obscure in how it was configured.

Re: Getting Started with Tmux

#46

As a heavy GNU Screen user for the last 2 decades it’s always in the back of my mind if I should be switching to tmux. Maybe there is a compatibility mode. For those who switched from screen what was the biggest benefit?

i switched a long time ago after one too many weird screen bugs, and i've never looked back. at this point i couldn't say why it's better, but you won't regret switching unless you regularly find yourself using boxes without screen.

Re: Getting Started with Tmux

#47

My favorite antipattern is, you can just leave a script that does an event loop running in the foreground, detatch tmux, and voila, you have a 'server'. Works great in a pinch or when you just don't need to finish it.

Add it within a infinitive loop + `sleep 10` and now it automatically restarts if it crashes too! :)

Re: Getting Started with Tmux

#48

The best way to use tmux is with -CC, which iTerm maps to native UI. tmux tabs and panes become native tabs and panes and your session is immortal, and it’s a far better experience than mosh or whatever the latest thing in this area is. I have never bothered to figure out how the keybindings actually work and I probably never will, but I enjoy using it all the time because of this.

does all of this work with the tmux keyboard shortcuts? the main reason I use tmux is to avoid the mouse...

Re: Getting Started with Tmux

#49

Tmux becomes more awesome when you use something like Alacritty or Kitty [EDIT: scratch Kitty, this mainly applies to Alacritty] and map your system's key (Apple's command key or... whatever it would be on Linux or Windows) and use that as your "tmux key". That way you can make single-chord bindings for all things tmux and life becomes better. If you use Vim, adding VimTmuxNavigator[0] improves things so much. For ex…

Interestingly enough, one of the stated goals of kitty is to make the usage of tmux unnecessary. Considering your comment (and many others like it), I don't think that has quite worked out. Still, kitty is one of my favorite terminal emulators and I'd urge anyone who hasn't tried it to give it a shot.

Yes, I mentioned in another comment that I only brought up Kitty for diplomatic reasons (which was weird of me, lol). I don't really know anything about Kitty other than it's often brought up as an alternative to Alacritty. I should have just left it at Alacritty!

Re: Getting Started with Tmux

#50

The only extra thing I want from tmux is to persist sessions across reboots and shutdowns. I found a plugin called tmux-resurrect but it would be nice as a base feature.

I use https://github.com/tmuxinator/tmuxinator for my workspaces. Doesn't save ad-hoc layouts, but usually I find one layout that works per project, then create a tmuxinator config for it, so after reboot, it's a short "tmuxinator start $my-project" away to get back to how I want it to be.
Post reply on HN