Detach, list, attach
The session is the outermost container and the reason to use Zellij at all. Detaching leaves the session running in the background and drops you back to your shell. Quitting tears it down. The difference is the whole point: detach is how work survives, quit is how it ends.
From your shell, three commands run the session lifecycle: list what’s running, attach to one, and kill one you’re done with. Name your sessions when you start them and this all gets easier; a random name is fine for a scratch session but useless when you have three going.
zellij ls # list running (and resurrectable) sessions
zellij attach whetstone # reattach by name (short: zellij a)
zellij kill-session whetstone # kill one session (short: zellij k)
zellij kill-all-sessions # prompt to kill them all (short: zellij ka)Try it yourself
Detach and reattach
The core session loop, end to end.
- In your
whetstonesession, split a couple of panes so there's state to preserve - Press
Ctrl othendto detach; you're back at your shell - Run
zellij lsand confirmwhetstoneis listed - Run
zellij attach whetstoneand confirm your panes are exactly as you left them
zellij ls, and reattached to find your panes intact.Keep it alive
Which action leaves your session running in the background?
Show answer
Correct answer: B — Ctrl o then d
Ctrl o then d detaches, leaving the session running. Ctrl q and kill-session both destroy it.