libtmux Reference MCP Search
On this page

tmux.Session.Kill

View as Markdown

Module
tmux
Declared in
Session
Package
github.com/libtmux/libtmux-go/tmux
Source
tmux/lifecycle_kill.go
Other languages
PythonTypeScriptRustJava.NETC++Swift
Kill ( ctx : context.Context ) error
method [source]
method [source]
Kill

Kill destroys the receiver session and removes its winlinks. Ordinary attached clients detach; on tmux 3.6 or later, clients carrying no-detach-on-destroy move to another session when one exists. A window with no remaining links and all of that window's panes are also destroyed. The materialized receiver is not refreshed. Only stderr makes a completed command a CommandError ; nonzero exits without stderr are ignored. Transport errors are delivery-ambiguous. Kill is equivalent to Session.KillWith with a zero SessionKillRequest .

In other languages End a session

Examples

Kill a session:

>>> session_1 = server.new_session()
>>> session_1 in server.sessions
True
>>> session_1.kill()
>>> session_1 not in server.sessions
True

Kill all sessions except the current one:

>>> one_session_to_rule_them_all = server.new_session()
>>> other_sessions = server.new_session(
...     ), server.new_session()
>>> all([w in server.sessions for w in other_sessions])
True
>>> one_session_to_rule_them_all.kill(all_except=True)
>>> all([w not in server.sessions for w in other_sessions])
True
>>> one_session_to_rule_them_all in server.sessions
True
await session.kill();

0 declared, 0 inherited

Esc

Type to search.