Live data from Hacker News

Using tmux properly

danielallendeutsch.com

81–90 of 218 posts

Re: Using tmux properly

#81
post #33

Yesterday I was helping a friend setting a box with no graphical session: I fired up tmux in the linux virtual terminal and then proceeded to realize without my tmux.conf I couldn't do a thing because I have always been using entirely different keybindings from the default. This is the problem with too much customization. Learning to use the default configuration may be difficult but it's probably worth the effort, f…

It gets worse when you work in ops and are constantly needing to remote into servers and you regularly have tmux within a tmux within a tmux... Littering config files across the datacenter just isn't an option.

I do 90% ops stuff and never have this issue with tmux, so I'm curious what your workflow's like. Why not just have tmux running on your host machine and ssh from a tmux window?

Re: Using tmux properly

#82
post #33

Yesterday I was helping a friend setting a box with no graphical session: I fired up tmux in the linux virtual terminal and then proceeded to realize without my tmux.conf I couldn't do a thing because I have always been using entirely different keybindings from the default. This is the problem with too much customization. Learning to use the default configuration may be difficult but it's probably worth the effort, f…

This is my experience as well. In my larval hacker days in the '90s, when my primary pastime was messing around with my Linux box all day long, I thoroughly enjoyed sifting through window manager and shell man pages to find each and every thing that could be configured, and I'd then proceed to configure each and every one of them to exactly what I wanted. My fvwm/bash/etc. config files from those days could probably be considered a form of outsider art by someone.

A common pattern in mailing lists/forums/etc. is the "just make it an option" guy. People are talking about their wishlists for future versions of , and sometimes these wishlists conflict. One group says a UI should be one way, another group says it should be some other mutually exclusive way, and a third group thinks the developers should implement both and just make it an option in a dotfile to make everyone happy.

Sometimes "just make it an option" guy is right, but in hindsight it should never be the default resolution to the disagreement. In those days I defaulted to "just make it an option", and really internalized that philosophy because it felt like all benefit and no cost. Why wouldn't you make everyone happy, if you could do that instead of making one group happy at the expense of another group? I think it's a really common trap people fall into early on because they have yet to directly perceive the costs that that approach can incur over time in software development. Sometimes they've also tricked themselves into overvaluing their workflows and muscle memory, which they may have defined in part because it was easier for them to define their own keybindings than memorize what the default ones were, which I now think is an antipattern in itself.

The main thing that changed for me is spending the intervening decades doing work on multiple machines all the time, running different versions of different OSes, often times starting from fresh installs. That made it more pragmatic to always learn software in its default config, and only tweak configs if it's absolutely necessary or otherwise pretty important to me. It's also forced me to learn all sorts of useful stuff that I probably wouldn't have otherwise. It also drove home just how much my desire to tweak configs was just because it was fun for me (and I had lots more free time back then), rather than something that made me more effective as an engineer.

But that's just from a user perspective. From a developer perspective, having "just make it an option" be the default form of conflict resolution leads to all sorts of unanticipated complications in practice. Every time an alternative code path is added for something, the code becomes a teensy bit more fragile and likely accrues a teensy bit of technical debt. The fragility and technical debt accrues over the years, and eventually can turn even the best software into an unmaintainable mess. I'm not dogmatic about it- some things should be options. It's just never my default position, and I have a much higher bar nowadays for making something an option.

Re: Using tmux properly

#83

What's the advantage of tmux over something like terminator with pane splitting?

There's subtile difference between terminal emulators (terminator) and terminal multiplexers (tmux, screen), mentioned elsewhere [0]. IMO the main difference: With tmux, your sessions can be separate from your terminal instance. Meaning that if your terminal dies for any reason (e.g. X dying), and you've set tmux up correctly, your session will still be there and all you have to do is (re)connect.

The other reasons are probably more personal. The initial tmux learning curve is steep, but once you've got it, it rewards you with a super fast workflow that suits you. I know this sounds extremely stupid, but the "hacker cred" is large with tmux. I got hooked on tmux by a coworker who used it and ruled. I've never seen that with terminator, although it should be equally possible.

[0] https://news.ycombinator.com/item?id=13338592#13341184 https://news.ycombinator.com/item?id=13342341#13348007 https://news.ycombinator.com/item?id=11995816#11998921

Re: Using tmux properly

#84
I used to be an extensive user of tmux, basically I'd have a sprawling set of sessions, all backed up with the continuum and resurrection plugins. It allowed me to armory seemlessly work remote on my main dev box or through SSH. Of course the biggest pain was consolidating the X11 clipboard and tmux's internal one.

Since I switched to Emacs though I've gradually peeled away the tmux layer. I still run without X11 version of Emacs so I can remote in, but Emacs itself does an equal or better job at pane management and session persistence, especially using daemon mode. ANSI term inside Emacs, something that has really improved in the past few years, has cinched the deal for me. Tmux had become bloat at this point for me.

Re: Using tmux properly

#85
post #57

Earlier quoted context omitted.

Terminator is an alternative to something like iTerm. Tmux is server based so the sessions persist after disconnecting from ssh for example and allow multiple users to connect to the same terminal

Out of curiosity, would you still use terminator/iterm if you used tmux in every shell? I understand term* provides some additional functions, but would you still consider it worthwhile?

Yes. I use both myself. I usually use multiple terminal panes and then have a separate tmux session running in each long lived pane.

Re: Using tmux properly

#86
post #46
post #33

Yesterday I was helping a friend setting a box with no graphical session: I fired up tmux in the linux virtual terminal and then proceeded to realize without my tmux.conf I couldn't do a thing because I have always been using entirely different keybindings from the default. This is the problem with too much customization. Learning to use the default configuration may be difficult but it's probably worth the effort, f…

I 120% agree. I once lost my emacs dotfile and suddenly i was almost unable to use Emacs on my own pc. Since then, i've decided to apply as little customisation as possible to software I use, and read the documentation and learn the standard configuration instead. For some reasons nowadays it's trendy to add colors, bells and whistles to things but I've found out that learning the standard/default configuration lets…

I did something different; I built my own config system that makes a PC account my own in about 20 minutes. My setup is effectively a program that needs to be installed, and I maintain it in a git repo, and it comes packaged with an installer. I'm a software engineer; I build tools to solve problems.

Emacs in particular is almost useless out of the box. But that's because of packages and modes; not because of key bindings and tweaks.

That being said, if a tool doesn't need extensive customization or doesn't ship with a broken config, I'll learn the defaults. I barely tweaked tmux.conf - I turned on xterm-keys and set-titles. And I've certainly reduced the depth of my configuration as the breadth of tools I use has increased.

And that's key: if most of my time is spent on one or two tools, it's well worth my time customizing those tools, because even fractional improvements will accumulate.

Re: Using tmux properly

#87

Earlier quoted context omitted.

That's why I have public dotfiles. Also this situation happens rarely. The whole beauty of software is that you can customize it and make it your own. The only downside I see with customization is that it can be huge timesink. I guess to each his own, but I think you're really missing out. P. S. Backups.

Regardless of the frequency of such a situation, it can really bite you when something big breaks and you need to ssh into a vanilla server in the middle of the night under pressure. Trying to fix a production fire under the gaze of an angry CEO is stressful enough, but not being able to take care of business on a box because of a missing personal config is truly one of the worst experiences I've ever had in this bus…

If the only time you see a production box is when it's on fire, I think there's an organizational problem.

Occasionally acting as third-line support means real production disasters aren't an unfamiliar zone.

Re: Using tmux properly

#88
post #64
post #44

Earlier quoted context omitted.

Yeah, I learned screen defaults, so ^A is far too strong of a habit to change.

I use screen, and in my book the choice of ^A for the default escape is a giant WTF, and remapping that is the first thing I do on a new account before starting to use screen (I use ^o, for no particular reason I suppose except it's not used by anything else I use). Don't the screen developers ever need to go to the beginning of a line in the shell or editor?

Well, I think a lot of it is because not everyone has historically had emacs mode defaulted in their shell. Lots of people who learned to use the shell in ksh (myself included) probably share similar feelings towards the emacs bindings. With that in mind, ctrl-a makes a lot of sense when you're not in emacs mode. `set -o vi` is a wonderful command ;).

Re: Using tmux properly

#89
> uses gnu screen on all servers.

> uses tmux on dev box

> advocates tmux but do not mention a single feature not on gnu screen.

why on earth would someone be that impractical?! just get a single gnu screenrc file that does all that and call it a day on every single environment you work on.

Re: Using tmux properly

#90
post #81

Earlier quoted context omitted.

It gets worse when you work in ops and are constantly needing to remote into servers and you regularly have tmux within a tmux within a tmux... Littering config files across the datacenter just isn't an option.

I do 90% ops stuff and never have this issue with tmux, so I'm curious what your workflow's like. Why not just have tmux running on your host machine and ssh from a tmux window?

It preserves the shell, history and outputs if the ssh session is dropped.
Post reply on HN