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-work

Start 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-sessions

Output:

zellij-0 (created 2h ago)
claude-work (created 30m ago)

Attach (Resume) Session

# Most recent session
zellij attach
 
# Specific named session
zellij attach claude-work

Full 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

ToolDetachReattachNotes
ZellijCtrl+O → Dzellij attach <name>Modern UX, named sessions
tmuxCtrl+B Dtmux attach -t <name>More portable
screenCtrl+A Dscreen -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> or zellij 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