What is Zellij? The tmux alternative for agent sessions
Zellij keeps terminal sessions running after SSH drops. Install it on a server, the session commands, the keys that collide with Claude Code, and locked mode.
Zellij is a terminal multiplexer, which its makers call a terminal workspace: one program that holds tabs and panes of shells and keeps them running after you disconnect. It does the job tmux does, with a first-run choice of key presets, floating panes, layouts in files, sessions that can be brought back after they exit, and a built-in web client. To keep a coding agent alive on a server, run zellij attach -c agent, start the agent, detach with Ctrl o then d, and run the same command to get back in. Its default keys use Ctrl, and several of them are Claude Code’s too, so press Ctrl g to lock Zellij while you work in the agent. The latest release is 0.46.0, from 11 November 2026.
What it is
The project’s README calls Zellij “a workspace aimed at developers, ops-oriented people and anyone who loves the terminal”, adding: “Similar programs are sometimes called ‘Terminal Multiplexers’.” It is MIT-licensed. As with tmux, detaching leaves a session “running in the background”, in the docs’ words, so closing the terminal or losing the SSH connection leaves everything inside it running.
Release 0.46.0 added zellij terminal, which opens Zellij as a desktop terminal window of its own. The release notes say “nothing changes for the normal multiplexer”, and on a server you use it the ordinary way, inside your SSH session.
Zellij or tmux
Both keep programs running when you disconnect, which is the part an agent needs. Where they differ:
- Setting it up. Zellij asks you to choose a key preset the first time it runs and has a settings screen for its keys. tmux is set up in a configuration file.
- Coming back after the server stops. Zellij writes each session’s layout and the command in each pane to disk (every 60 seconds by default) and can recreate a session that has exited. A tmux session is gone when its server stops, as what tmux is and what it cannot survive covers.
- In the browser. Zellij has a web client built in (below); tmux does not.
- Keys. tmux takes one prefix key,
Ctrl b, and leaves every other key to the program. Zellij’s default preset takes a row of Ctrl and Alt keys directly, which is the main thing to set up before running an agent in it. - Familiarity. tmux is what most agent-on-a-server guides assume. Zellij has a
tmuxmode onCtrl bfor people coming from it.
Installing it on a Linux server
The release ships static (musl) builds for x86_64 and ARM Linux. The musl builds leave out the desktop terminal window, which a server has no use for. Following the installation page, download, unpack and put the binary on your PATH:
curl -LO https://github.com/zellij-org/zellij/releases/latest/download/zellij-x86_64-unknown-linux-musl.tar.gz
tar -xvf zellij-x86_64-unknown-linux-musl.tar.gz
chmod +x zellij
mkdir -p ~/.local/bin && mv zellij ~/.local/bin/
zellij --versionCopiedOn an ARM server, use zellij-aarch64-unknown-linux-musl.tar.gz. With Rust installed, cargo install --locked zellij builds it instead. If you use a distribution package, compare its version with the latest release. To try it without installing anything, the project’s launch script downloads and runs a copy:
bash <(curl -L https://zellij.dev/launch)CopiedKeeping an agent running: the session commands
Over SSH on the server, start (or rejoin) a named session and launch the agent inside it:
zellij attach -c agent # attach to "agent", creating it if needed
claude # or codex, opencode...
# detach: Ctrl o, then d (the agent keeps running)
zellij ls # list sessions
zellij attach agent # reattach from any later connection
zellij kill-session agent # stop the session and everything in it
zellij delete-session agent # forget an exited sessionCopiedzellij attach -c is the one command to remember, because it works whether or not the session exists yet. zellij --session agent also names a new session. Inside Zellij, zellij action detach detaches too. Ctrl q is not a detach: it quits Zellij, stopping the programs in its panes. Short forms exist for the commands (a, k, d), and kill-all-sessions asks before it stops everything.
If the connection itself keeps dropping, on a train or a phone, mosh keeps the connection while Zellij keeps the program.
Modes, and the keys that collide with the agent
Zellij works in modes. In the default preset you start in normal mode, and a Ctrl key enters each of the others (from the preset file in the 0.46.0 source):
Ctrl ppane,Ctrl ttab,Ctrl nresize,Ctrl hmove,Ctrl sscroll,Ctrl osession,Ctrl btmuxCtrl glocked, andCtrl qquit- Alt with
n,f,h/j/k/l,i,o,p,[,],=and-act directly (new pane, floating panes, focus, tabs, resize)
Zellij takes these keys before the program in the pane sees them. Set against Claude Code’s keybindings, in the default preset:
Ctrl g: Claude Code opens the prompt in your editor; Zellij locks instead.Ctrl+X Ctrl+Estill reaches Claude Code.Ctrl o(verbose transcript),Ctrl t(to-do list) andCtrl s(stash the prompt) open Zellij modes instead.Ctrl b(send a running task to the background) enters Zellij’s tmux mode; press it twice, or useCtrl+X Ctrl+B.Ctrl pandCtrl nmove through Claude Code’s lists; the arrow keys do the same and are not taken.Ctrl his a backspace byte to most terminal programs, and Zellij takes it for move mode.Alt p(model picker) andAlt o(fast mode) are Zellij pane and tab keys.
Ctrl j, Claude Code’s new-line key, is not one of Zellij’s, so it reaches the agent in every mode; the other ways of starting a new line are in Claude Code’s new-line keys.
Locked mode and the unlock-first preset
In locked mode Zellij passes every key to the pane except Ctrl g, which unlocks it. Two ways to use that:
Lock by hand. Keep the default preset, press Ctrl g after starting the agent, and work. To detach, unlock first: Ctrl g, then Ctrl o, then d.
Start locked. The unlock-first preset is made for programs whose shortcuts collide with Zellij’s. Zellij starts locked, and every mode is Ctrl g followed by one letter: p pane, t tab, s scroll, o session, m move, r resize. Detaching is Ctrl g, o, d, and after each action Zellij locks again. Choose it on the first-run screen, in the settings screen under Keyboard, or in ~/.config/zellij/config.kdl:
keybinds preset="unlock-first" {
}CopiedEither way, the agent then loses only Ctrl g, and Claude Code’s Ctrl+X Ctrl+E covers what that key did. The Alt keys belong to the pane too while Zellij is locked.
Session resurrection
Zellij saves each session’s tabs, panes and the command running in each pane to its cache folder, by default every 60 seconds. When a session exits, through Ctrl q or a crash, it stays in zellij ls as exited, and zellij attach on its name brings the layout back. Per the resurrection page, “Zellij does not immediately run resurrected commands, but rather places them behind a ‘Press ENTER to run...’ banner”; attach with --force-run-commands to skip it.
What comes back is the command, not the process. A pane that was running claude starts a new Claude Code, and the conversation it was in is only reachable through the agent’s own resume (see resuming a Codex or Claude Code session). zellij action set-resurrect-command sets the command a pane comes back with, so a pane can come back running a resume command instead. The docs describe recovery after a quit or a crash and do not mention reboots; since the saved state is on disk, a session should be listed after one, but that is inference.
Layouts
A layout is a KDL file that opens tabs and panes, each pane optionally running a command. A pane with the agent and one with a shell, saved as agent.kdl:
layout {
pane split_direction="vertical" {
pane command="claude"
pane
}
}CopiedStart it with zellij --layout agent.kdl, or put it in the layouts folder of the config directory and use its name. Writing pane command="claude" start_suspended=true makes the pane wait for Enter instead of starting the agent at once.
The web client
Since 0.43 Zellij can serve its sessions to a browser. The server is off by default; start it with zellij web or from the share screen (Ctrl o, then s). It listens on http://127.0.0.1:8082, and signing in takes a token made with zellij web --create-token, shown once; --create-read-only-token makes one that can watch but not type. Per the web client page, serving on any address other than 127.0.0.1 requires HTTPS with your own certificate, and the server has no rate limiting of its own.
Left on 127.0.0.1, the page is reachable from your own computer through an SSH tunnel:
ssh -L 8082:127.0.0.1:8082 you@your-serverCopiedthen open http://127.0.0.1:8082 in the local browser. From a phone, an SSH app attached to the session is the simpler route; SSH from your phone covers the apps and keys.