libtmux Reference MCP Search
On this page

session.Session.kill

View as Markdown

Module
session
Declared in
Session
Package
libtmux
Source
crates/libtmux/src/session.rs
Other languages
PythonTypeScriptGoJava.NETC++Swift
kill ( self ) Result<(), Error>
method [source]
method [source]
kill

Kill the session.

This consumes the handle: every other handle to the same session is now stale, and refreshing one reports Error::ObjectGone .

Errors

Returns an error when tmux refuses the command.

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.