On this page
libtmux.Server.new_session
- Module
- libtmux
- Declared in
- Server
- Package
- libtmux
- Source
- src/libtmux/server.py
- Other languages
- TypeScriptRustGoJava.NETC++Swift
-
Create new session, returns new
Session.Uses
-Pflag to print session info,-Ffor return formatting returns new Session object.$ tmux new-session -dwill create the session in the background$ tmux new-session -Adwill move to the session name if it already exists. todo: make an option to handle this.Examples
Sessions can be created without a session name (0.14.2+):
>>> server.new_session() Session($2 2)Creating them in succession will enumerate IDs (via tmux):
>>> server.new_session() Session($3 3)With a
session_name:>>> server.new_session(session_name='my session') Session($4 my session)- Parameters
- Returns
- Raises
In other languages Create a session
Examples
Sessions can be created without a session name (0.14.2+):
>>> server.new_session()
Session($2 2) Creating them in succession will enumerate IDs (via tmux):
>>> server.new_session()
Session($3 3) With a `session_name`:
>>> server.new_session(session_name='my session')
Session($4 my session) const created = await server.newSession({ name: "work" });
created.name; // "work" 0 declared, 0 inherited