Session commands
Start, attach to, detach from, and end koshi sessions from any shell.
A session runs in its own process. These commands start one, join one, leave one, and end one. The concepts are on Attach and detach.
Start
koshi # start and attach this terminal
koshi --profile dev # start from profile/dev.kdl
koshi --headless # start with nothing attached--headless prints the session id and returns to the shell. Nothing is drawn.
koshi --headless
[SESSION ID]: session-3f2a…attach
koshi attach # pick from the running sessions
koshi attach S-amber-fox # by name
koshi attach session-3f2a… # by idRun outside koshi, attach opens that session in this terminal. Run inside a
koshi pane, it moves this terminal to the named session instead.
With no argument and several sessions running, koshi numbers them and reads your answer:
koshi attach
1) S-amber-fox session-3f2a…
2) S-quiet-heron session-91c4…
attach to which session? [1-2]detach
koshi detach # inside a pane: this terminal
koshi detach client-0e5a… # a client id
koshi detach session-3f2a… # that session's client, by id
koshi detach S-amber-fox # the same, by session name
koshi detach --all S-amber-fox # every terminal of that sessionDetaching leaves the session running with its panes untouched. Bare
koshi detach works only inside a koshi pane. Outside one, name the target: a
client id, a session id, or a session name.
A session left with no terminal keeps running, unless auto-close-session is
#true in the koshi.kdl the session read when it started.
kill-session
koshi kill-session # the only running session
koshi kill-session S-amber-fox # by name
koshi kill-session session-3f2a… # by idEnds the session and everything in it, whatever is attached. An id goes straight to that session with no lookup. With no argument it works only when exactly one session is running.
kill-session skips the wait that auto-close-session gives programs to stop.
| Exit code | Meaning |
|---|---|
3 | Unknown session name or id |
4 | The control socket could not be reached |
list-sessions
koshi list-sessions
koshi list-sessions --format jsonPrints session ids and names. See Discovery for tabs, panes, and clients.
Summary
| Command | Result |
|---|---|
koshi --headless | Start a session with nothing attached and print its id |
koshi list-sessions | List session ids and names |
koshi attach [NAME_OR_ID] | Attach this terminal to that session |
koshi detach [CLIENT_OR_SESSION] | Detach one terminal; the session keeps running |
koshi detach --all [NAME_OR_ID] | Detach every terminal of that session |
koshi kill-session [NAME_OR_ID] | End that session, or the only running one |