shaky.sh

The benefits of using tmux

I've used tmux to manage multiple open terminals for years now. There are two reasons that really make the experience for me. Both are related to how you can detach from a running tmux session and then reconnect to it.

Restore a dropped session

When you're moving between your terminal and other applications all day, you're likely to accidentally close a window at some point. In a standard shell, that means you've just lost whatever state you had: running processes, ad-hoc aliases, vim buffers, etc. If you accidentally close a terminal window that's running tmux, no sweat. You can just open a new window, attach to the existing tmux session, and keep going!

tmux attach -t <session-name-or-index>

Pop in across machines

Since I work remotely, I have a work and personal machine on my home network. I keep them as separate as possible, but sometimes a work idea will strike me when I'm on my personal machine, or vice versa. I can easily SSH from one machine to the other, and then attach to a running tmux session. That session will have the state of my current project all ready to go. I can easily jot down a few notes or lines of code, and then disconnect. No need to worry about, say, a file already being open in another process: I can use the same vim process that's likely still open on my other machine.

Of course, tmux has so much more to offer, but I haven't seen these capabilities elsewhere.