LibTmux.New-TmuxSession
LibTmux\New-TmuxSession Create a detached session on an explicit server.
Source and package
- Declared in
- LibTmux
- Package
- LibTmux
- Source
- src/LibTmux.PowerShell/NewTmuxSessionCommand.cs
- New-TmuxSession [-Server] <Lib
Tmux > [-Name <System.Server .String >] [-WindowName <System.String >] [-StartDirectory <System.String >] [-Command <System.String >] [-Width <System.Nullable [System.Int32 ]>] [-Height <System.Nullable [System.Int32 ]>] [-Environment <System.Collections >] [-What.IDictionary If ] [-Confirm] [<CommonParameters >] -
Description#
Createa session and its initial window and pane, then return the captured nativeLibTmux.Session. TheServerparameter accepts a native endpoint handle directly or through the pipeline. The core can start the daemon when that endpoint has no server. Existing session names remain errors; the command does not replace or attach to an existing session.Notes
WhatIfreports the intended endpoint without discovery, daemon startup or dispatch, and returns no created object. Confirmation precedes the core operation. Success does not transfer ownership of the daemon to the module or arrange automatic cleanup. Cancellation can occur after a session was created; it is not rollback and the module does not retry. Per-owner errors useTmux.SessionCreateFailedand retain the core exception and failed server.ErrorActionContinue allows later owners to run.Command details#
- Command type
cmdlet- Confirmation
- Supports
-WhatIfand-Confirm; confirm impact: Medium. - Positional binding
- Enabled.
- Pipeline inputs
-
LibTmux.Server: Native pipeline type for this command. - Outputs
-
LibTmux.Session
Examples#
Example 1
Createa detached session on the server identified by the absolute$SocketPath. Choose an endpoint you control; the created session remains running until you remove it. View sourceTerminal window $options = @{Name = 'help-session'WindowName = 'work'Command = 'exec /bin/sh'}LibTmux\New-TmuxServer -SocketPath $SocketPath |LibTmux\New-TmuxSession @options- Parameters
-
-
Native server endpoint in which to create the session. This is the only pipeline-bound parameter; binding by an object's
Serverproperty is not supported.- Required
- Yes
- Position
- 0
- Pipeline input
- By value
- Validation
ValidateNotNull()
-
Sessionname. Omit it to let tmux choose. An existing name remains an error; tmux's name and format rules apply.- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNullOrEmpty()
-
Name of the initial window. Omit it to retain tmux's default naming behavior.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNullOrEmpty()
-
-StartDirectory(System.String ) #Working directory for the new pane. Use an absolute filesystem path for predictable behavior. The core expands ~ and ~/; this cmdlet does not resolve PowerShell provider paths or change the host's current directory.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNullOrEmpty()
-
Oneshell-command string for the new pane. tmux interprets shell syntax in this string; it is not an argument array. Omit it to use the configured default command or shell.- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNullOrEmpty()
-
-Width(System.Nullable [System.Int32 ]) #Initial width in terminal cells, at least 1. Omit it to use tmux's default dimensions.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateRange(1, 2147483647)
-
-Height(System.Nullable [System.Int32 ]) #Initial height in terminal cells, at least 1. Omit it to use tmux's default dimensions.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateRange(1, 2147483647)
-
-Environment(System.Collections ) #.IDictionary A dictionary with string names and string values. Names must be nonempty and contain neither '=' nor NUL (U+0000). Values may be empty but must not contain NUL. Null or non-string entries are rejected before confirmation or dispatch. Entries are copied for this invocation and do not change the PowerShell host environment.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNull()
-
-WhatIf(System.Management ) #.Automation .Switch Parameter Runs the command in a mode that only reports what would happen without performing the actions.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Switch
- Yes
- Aliases
wi
-
-Confirm(System.Management ) #.Automation .Switch Parameter Prompts you for confirmation before running the cmdlet.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Switch
- Yes
- Aliases
cf
Common parameters 12
PowerShell supplies these parameters. See common parameter behavior for their effects.
-
-Verbose(System.Management ) #.Automation .Switch Parameter Display verbose messages produced by this command.
Aliases:vbMicrosoft Learn reference -
-Debug(System.Management ) #.Automation .Switch Parameter Display debug messages produced by this command.
Aliases:dbMicrosoft Learn reference -
-ErrorAction(System.Management ) #.Automation .Action Preference Choose how this command responds to non-terminating errors.
Aliases:eaMicrosoft Learn reference -
-WarningAction(System.Management ) #.Automation .Action Preference Choose how this command responds to warning messages.
Aliases:waMicrosoft Learn reference -
-InformationAction(System.Management ) #.Automation .Action Preference Choose how this command handles information messages.
Aliases:infaMicrosoft Learn reference -
-ProgressAction(System.Management ) #.Automation .Action Preference Choose how this command handles progress updates.
Aliases:progaMicrosoft Learn reference -
-ErrorVariable(System.String ) #Store the command's error records in the named variable.
Aliases:evMicrosoft Learn reference -
-WarningVariable(System.String ) #Store the command's warning records in the named variable.
Aliases:wvMicrosoft Learn reference -
-InformationVariable(System.String ) #Store the command's information records in the named variable.
Aliases:ivMicrosoft Learn reference -
-OutVariable(System.String ) #Save output in the named variable while passing it down the pipeline.
Aliases:ovMicrosoft Learn reference -
Buffer output before passing it to the next pipeline command.
Aliases:obMicrosoft Learn reference -
-PipelineVariable(System.String ) #Make the most recent output object available through a named variable within the pipeline.
Aliases:pvMicrosoft Learn reference
-
- Returns
-
LibTmux.Session: Captured native object for the created resource.
Discussed in Create windows and panes · Create sessions, windows and panes