tmux keeps your agent alive, but not if you shut your laptop. Here is exactly where the line sits
tmux is a real tool and worth learning if you work with agents: your session keeps living even when you close the terminal, and you can watch four agents side by side. But the line that gets repeated the most is not true: shut the lid, cut the Wi-Fi, come back in an hour and the work is done. When the lid closes the machine sleeps and every process freezes. The session does not die, but nothing moves during that hour either. Cut the Wi-Fi and the agent cannot reach its API anyway. tmux does not take the work off your computer, it detaches it from the terminal. Also, tmux does not run on Windows; it is not in the tool's own list of supported systems. Below: what it actually does for you, verified install commands, the nine keys you need, the three things that will annoy you on day one, and the real recipe for closing the lid and walking away.
The tool itself
The repo is here. tmux is a terminal multiplexer: it lets you open several terminals inside one window, move between them, and leave them all running in the background. It is not a new tool, it is a standard one that people working on servers have used for years.
What is extra below: why the most repeated claim is wrong, what actually happens when you shut the lid, why it does not run on Windows and how to run it there anyway, install commands verified at the source, the nine keys that cover daily use, the three things that will annoy you on day one, and the recipe for closing the lid that actually works.
Where it actually helps
When you run an agent in a terminal, the work is tied to that terminal window. Close the window, drop the SSH connection, or shut the terminal by accident, and the work goes with it. tmux steps in between: the process is now attached to the tmux server sitting in the background, not to the window. Close the window and the session keeps living.
What the work is tied to
Without tmux
the work is tied to the terminal window
- Close the window and the agent dies
- If SSH drops, the work stops halfway
- You can watch one thing at a time
With tmux
the work is tied to the session
- Close the window, the session lives on
- If SSH drops, the work continues on the server
- You watch four things at once in four panes
The second benefit is splitting the screen. An agent writing code in one pane, tests in another, server logs in a third, you in the fourth. All in one window, all visible at once. When you work with an agent, this is noticeably more comfortable than flipping between tabs.
The shut the lid and come back in an hour part is not true
This sentence shows up in almost every tmux explainer and it sounds great. But tmux does not take the work off your computer, it only detaches it from the terminal window. The work still runs on your machine. If the machine stops, the work stops.
What is said and what happens
Shut your laptop lid, come back in an hour, the work is done
When the lid closes the machine sleeps and every process freezes. The session does not die and it resumes when you wake it, but not a single line moves during that hour
Cut the Wi-Fi, the agent keeps working
The agent calls an API at every step. If the network goes, the agent stops. tmux has nothing to do with your network connection
tmux moves the work off your computer
tmux detaches the work from the terminal, not from the machine. Shut down or restart the computer and the tmux server goes with it, taking the session
If you really want to close the lid and walk away
There is a scenario where the claim holds, but it has one condition: the work has to run on another machine, not your laptop. This is what tmux has actually been used for all along, long before agents existed.
The actual recipe
- 1
Rent a server
A small VPS is enough. The work runs there, not on your laptop
- 2
Connect over SSH
You log in from your own terminal and you are in its shell now
- 3
Start the agent inside tmux
Open a tmux session on the server and run the agent inside it
- 4
Detach and leave
Detach with Ctrl+b then d and close SSH. Now you can shut your laptop
The difference: your laptop is just a screen now. It closing, sleeping or losing Wi-Fi does not touch the work, because the work is not there. In this setup tmux is required, not decoration: the moment the SSH connection drops, the process you started on the server dies with it, and preventing exactly that is what tmux does.
There is a cost, know it upfront
Running the agent on a server means your code and your API keys live there too. You will pull the repo onto it, put the keys on it, and that machine's security becomes your job. For a quick experiment tmux on your laptop is more than enough; a server only makes sense once you genuinely want to walk away from work that runs for hours.
Install, and the Windows trap
tmux does not run on Windows
tmux's own documentation lists the systems it supports one by one: OpenBSD, FreeBSD, NetBSD, Linux, macOS and Solaris. Windows is not on that list. You cannot install tmux in PowerShell or Command Prompt, and it is not a matter of configuration. The fix is WSL: a real Linux running inside Windows. Once it is installed you install tmux on the Linux side and everything works normally.
# In PowerShell opened as administrator
wsl --install
# Restart the machine, open Ubuntu, set a username and password
# Then, in the Ubuntu terminal
sudo apt install tmuxThe wsl --install command enables the required components, installs Ubuntu by default and asks for a restart. It works on Windows 11 or on Windows 10 build 2004 and above. If WSL is already installed the command just prints its help text, in which case skip straight to the second step.
# macOS
brew install tmux
# Ubuntu, Debian and WSL
sudo apt install tmux
# Fedora
sudo dnf install tmux
# Arch
sudo pacman -S tmuxThe nine keys that cover daily use
The logic of tmux: you press Ctrl+b and release it, then press the command key. Not together, one after the other. Ctrl+b is called the prefix key in tmux and almost everything starts with it. The moment you see the dark bar at the bottom, you are inside a tmux session.
These are enough
| What you want to do | What you type |
|---|---|
| Start a new session | tmux new -s ajan |
| Detach, leave it running | Ctrl+b then d |
| See open sessions | tmux ls |
| Come back to a session | tmux attach -t ajan |
| Split side by side | Ctrl+b then the percent sign |
| Split top and bottom | Ctrl+b then the double quote |
| Move between panes | Ctrl+b then the arrow keys |
| Make one pane full screen | Ctrl+b then z |
| Close the session for good | tmux kill-session -t ajan |
The word ajan here is just the name you give the session, use whatever you like. Naming is optional, but once you have three sessions you will want to know which is which. To see every key binding press Ctrl+b then the question mark, and q to leave that view.
The three things that will annoy you on day one
None of these are bugs, they are tmux defaults. But running into them without warning makes it feel like the tool is broken.
First and most annoying: the mouse wheel does nothing. Mouse support is off by default in tmux. To scroll up you press Ctrl+b then the left square bracket to enter copy mode, move with the arrow keys, and press q to leave. This is the first wall you hit while trying to read a long stretch of agent output. The permanent fix is to turn the mouse on.
# Add this to ~/.tmux.conf
set -g mouse on
# To apply it right away in a running session
tmux source-file ~/.tmux.confSecond: the split keys feel backwards. The percent sign splits the screen side by side, the double quote splits it top and bottom. tmux's own docs call these horizontal and vertical splits, but the names describe the direction of the dividing line, not how the panes end up sitting. There is no shortcut for remembering this, just try both once and see which does what.
Third: Ctrl+b clashes with some programs. Emacs and a few terminal tools use that combination themselves. tmux lets you change the prefix key through the prefix option in the config file. If you are not hitting a clash, leave it alone, the default is a good choice.
DOA: Yapay Zeka ve Otomasyon
Installing these tools on your own is one thing; actually building with them is another. The community has people using these daily and people building systems from scratch.
If you want a system that actually runs in your business, let's talk for 10 minutes; I'll look at what you're trying to build and tell you which path fits. Free, and not a sales pitch.
Book a 10-minute callIf you'd rather learn this alongside people doing the same work instead of on your own, the community is always open:
Join the communityThis is an affiliate link.