Claude Code — Zellij Session Management
Zellij is a terminal workspace (like tmux/screen) that keeps long-running Claude Code sessions alive after disconnecting from a terminal or SSH session. Unlike tmux, it has a modern UX and named sessions work immediately.
Why / When to Use
When running Claude Code on a remote server (or local machine) and you need to disconnect without killing the session. Essential for overnight autonomous runs or remote dev workflows.
Core Concept / Commands
Start a Named Session
zellij --session claude-workStart Claude Code inside, then work normally.
Detach (Hide) Session — Keep It Running
Ctrl+O → D
Or simply close the terminal window — the session keeps running.
List Running Sessions
zellij list-sessionsOutput:
zellij-0 (created 2h ago)
claude-work (created 30m ago)
Attach (Resume) Session
# Most recent session
zellij attach
# Specific named session
zellij attach claude-workFull Remote Workflow
# On remote machine — start session
zellij --session myproject
# ... start claude, run processes ...
# Detach with Ctrl+O → D
# Come back later (SSH in again)
ssh user@server
zellij attach myproject
# Everything still running ✅Key Options / Variants
| Tool | Detach | Reattach | Notes |
|---|---|---|---|
| Zellij | Ctrl+O → D | zellij attach <name> | Modern UX, named sessions |
| tmux | Ctrl+B D | tmux attach -t <name> | More portable |
| screen | Ctrl+A D | screen -r <name> | Older but universal |
Gotchas
- If you close the terminal without detaching first, the session still persists — Zellij handles it.
- Sessions accumulate if you don’t clean up:
zellij kill-session <name>orzellij kill-all-sessions. - On macOS, Zellij integrates well with iTerm2; on Linux, works in any terminal emulator.
Source
Conversation: “CC-Session screen” — 2026-05-16