In this presentation Stanislas Polu, co‑founder and technical founder of the Instagram analytics platform Nitrogram, introduces tmux – a terminal multiplexer – and demonstrates why it is valuable for system administrators and remote development teams. He explains tmux’s client‑server design, which uses Unix domain sockets and the OpenPTY system call to create independent pseudo‑terminals that can be attached to a single bash process. Core features are shown: creating new windows (Ctrl‑B C), detaching a session (Ctrl‑B D) and re‑attaching later from any machine, and sharing a session by making the socket world‑writable so multiple users see a synchronized screen. Polu then showcases tmux’s scriptability: launching a detached shared session that automatically opens three SSH windows to a MongoDB replica set, enabling a single command to connect to multiple servers in sync. He emphasizes how these capabilities improve team workflows, remote collaboration, and routine server administration. Finally, he notes the broader tmux ecosystem – community‑built tools, frameworks, and the high‑quality VT100 emulation – and encourages both newcomers and experienced users to explore its code and extensions.
Chapters
Hi everyone. Today, so, at day I'm the co-founder, technical founder of Nitrogram. It's an analytics platform for Instagram. And at night I like to work on terminal emulation. So I wanted to talk a little bit about tmux today. So what is tmux? tmux, you must— some of you must know it. It lets you switch easily to terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them. They keep running in the background and reattach them to a different terminal and do a lot more. It's very convenient when you sysadmin some servers, and especially when you do it as a team. So let's see how it works. So I'm a heavy user of tmux, and before I prepared this presentation, I was faced with that and I was like, well, what? And so I figured that there should be some materials to do a presentation. So what happens when you run tmux, Basically, it's a client-server architecture, which means that you've got a client that gets attached to your terminal. It connects to servers through Unix domain sockets, and the server attaches to a new terminal through the OpenPTY system call and attaches itself to a new bash. And that's the basic principle behind multiplexing a terminal. So the first feature is to run multiple programs in the same terminal. So when you type Ctrl+B, C, it creates a new tab And what happens is that there's a new pseudo terminal that opens on the server attached to a new bash. So one nice feature of tmux is the ability to detach from a session. So let's say you're on a server and you want to run a lunc process. You can just run it into tmux and then call— type Ctrl+B D. It's going to detach you from your existing session, which means that your client is going to be killed and you end up in your original bash. And the server keeps running. Whenever you want to reattach to your server, you can do it from another computer or the next day. You just run tmux attach and you're back into your session like nothing happened. So that's pretty cool. Anyway, so then screen sharing is really also a very, very important feature of tmux. We use it a lot as a team, especially when we work remotely. So here what I'm doing is that I'm starting tmux on a specified path for or the Unix domain socket, and I make it writable to everyone. And then somebody else can come in and connect or attach to the same socket, which means that basically we've got the same synchronized screens running in each of our terminals, but it's the same server behind. So we effectively share our sessions. So that's pretty cool. And basically we use it a lot, and really we've seen that starting to use it our usage of stuff's changed. So that's the last sysadmin trick that we use also. Whenever you have to administrate some servers, it's pretty handy. One nice feature is that tmux is scriptable, meaning that you can alter the state of tmux by the command line. So what we do here is that we start tmux in a shared state like we did before, and we start it in a detached mode with the -d option up there. And what we do is that we open 3 windows connecting through SSH to 3 different servers. In our case here, it's as an example 3 nodes from a replica set of a MongoDB shard. And this way with a simple command, you just type this, the name of the script, you instantly get forwarded to those 3 computers. You don't have to type your SSH to all those computers. So that's very handy, especially if you can do it in a synchronized way with somebody working remotely. So that's pretty much all. tmux is very powerful. But I think you all— I mean, everybody has to create its own usage. I've posted this thing on Hack News yesterday, and I've seen a bunch of comments saying that, hey, I've created this tool. I've created this framework to run some specific sessions. So there's a whole ecosystem around it. And well, if you already know tmux, I really invite you to look at the code as well, because it's one of the best VT100 emulation code I've seen. And if you don't know it, I really invite you to test it. Thank you. Thank you, Stanislas Polu. Thanks.