LibTmux.New-TmuxServer
Construct a tmux endpoint handle without contacting it.
Source and package
- Name (default): New-TmuxServer [-Socket
Name <System.String >] [-TmuxBinary <SystemPath .String >] [-ConfigurationFile <System.String >] [<CommonParameters >]Path: New-TmuxServer -SocketPath <System.String > [-TmuxBinary <SystemPath .String >] [-ConfigurationFile <System.String >] [<CommonParameters >] -
Description#
Choose a socket name or absolute socket path. Construction performs no tmux I/O and does not start or own a daemon. A later command explicitly acquires data or changes tmux.
Omitting both socket parameters passes tmux no socket, so tmux picks the server: the one the TMUX variable names inside a tmux pane, otherwise its default socket. Two variables choose a socket for such a handle. LIBTMUX_SOCKET_PATH becomes
-Sand LIBTMUX_SOCKET becomes-L; when both are set the path wins, and a blank value counts as unset. A parameter beats both variables. The handle reads the variables when it is made. LIBTMUX_SOCKET_NAME, which earlier versions read, selects nothing.What is on here. Most cmdlets in the module start from the handle this one returns. They take it directly, or take a session, window, pane or client that was read through it. The cmdlets fall into a few groups:
Connecting.
New-TmuxServerbuilds the handle.Connect-TmuxServerdiscovers the live server behind it and returns a connected replacement, andGet-TmuxServerreads the daemon's identity and version without starting one.Connect-TmuxControlopens a control client andDisconnect-TmuxControlcloses it.Finding one thing.
Get-TmuxSessionandGet-TmuxWindowselect by id or name,Get-TmuxPaneby id, andGet-TmuxClientby name. A selector that matches nothing emits nothing.Get-TmuxClientAttachmentresolves the session, window and pane a client is viewing.Listing everything.
Get-TmuxSession,Get-TmuxWindow,Get-TmuxPaneandGet-TmuxClientlist everything on the server when given no selector. A missing daemon writes an error instead of returning an empty list.Get-TmuxSnapshotcaptures the hierarchy to a depth you choose and returns a replacement server.Update-TmuxPaneandUpdate-TmuxClientread one object again into a new capture.Querying things and getting around.
New-TmuxQuerybuilds reusable criteria.Select-TmuxSession,Select-TmuxWindowandSelect-TmuxPanefilter objects you already captured without contacting tmux, and can require exactly one match.Invoke-TmuxQueryacquires fresh objects instead.Get-TmuxQueryFieldlists the fields and operators,Get-TmuxQueryPlanshows how a query will run, andConvertTo-TmuxQueryJsonserializes one. To move down the hierarchy, pass a session toGet-TmuxWindoworGet-TmuxPane, or a window toGet-TmuxPane.Changing things.
New-TmuxSession,New-TmuxWindow,Split-TmuxPaneandNew-TmuxWindowLinkcreate, andNew-TmuxSessioncan start a daemon that is not running yet.Move-TmuxWindow,Set-TmuxLayout,Set-TmuxPaneSizeandSet-TmuxWindowSizerearrange.Remove-TmuxSession,Remove-TmuxWindow,Remove-TmuxWindowLinkandRemove-TmuxPanedelete.Options and hooks.
Get-TmuxOption,Set-TmuxOptionandRemove-TmuxOptionread, write and unset options on a server, session, window or pane.Get-TmuxHook,Set-TmuxHookandRemove-TmuxHookdo the same for hooks, andInvoke-TmuxHookruns one now.Get-TmuxEnvironment,Set-TmuxEnvironmentandRemove-TmuxEnvironmentmanage the environment table of a server or session.Everything else tmux keeps.
Send-TmuxTextandSend-TmuxKeytype into a pane,Get-TmuxPaneContentreads what it shows, andWait-TmuxPaneTextwaits for text to appear.Invoke-TmuxPaneCommandruns a shell command in a pane and reports its exit status.Wait-TmuxChannelwaits for a channel signal, andWatch-TmuxEventstreams events from a control client.Things that need a terminal.
Enter-TmuxSessionattaches your foreground terminal to a session and returns when you detach. Run it outside tmux; it rejects redirected input.Anything tmux can do that is not here is reachable through
Invoke-TmuxCommand, which runs literal tmux arguments and returns the result.Invoke-TmuxChainruns several commands in order,New-TmuxCommandbuilds one without running it, andInvoke-TmuxControlCommandsends one over a control client.Notes
The returned
LibTmux.Serveris unmaterialized. TmuxBinaryPath andConfigurationFileaffect subsequent operations; construction does not execute them.Command details#
- Command type
cmdlet- Default parameter set
- Name
- Positional binding
- Enabled.
- Outputs
LibTmux.Server
Examples#
Example 1 Construct a handle for the existing socket identified by
$SocketPath. View sourceTerminal window LibTmux\New-TmuxServer -SocketPath $SocketPath- Parameters
-
-
-SocketName(System.String ) forName#The tmux socket name, passed as
-L. It beats LIBTMUX_SOCKET and LIBTMUX_SOCKET_PATH.- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNullOrEmpty()
-
-TmuxBinaryPath(System.String ) #The tmux executable used by subsequent operations.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNullOrEmpty()
-
-ConfigurationFile(System.String ) #The configuration used if a later operation starts tmux.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNullOrEmpty()
-
-SocketPath(System.String ) forPath#The absolute socket path, passed as
-S. It beats LIBTMUX_SOCKET and LIBTMUX_SOCKET_PATH.- Required
- Yes
- Position
- Named
- Pipeline input
- No
- Validation
ValidateNotNullOrEmpty()
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.Server: Native pipeline type for this command.
Guides#
Pages that discuss New-TmuxServer.
- Topics
In other ports#
A tmux server
| Language | Equivalent |
|---|---|
| Python | libtmux |
| Ruby | Lib |
| Lua | libtmux |
| Julia | Lib Server describes an endpoint without contacting tmux. Read its hierarchy with snapshot. |
| Elixir | Lib Server describes an existing server by executable and socket. It neither connects nor reserves the server’s identity. |
| TypeScript | server |
| Rust | server |
| Go | tmux |
| Java | io |
| Kotlin | io |
| Scala | io |
| C# | Lib |
| F# | Lib This F# module provides functions over the shared .NET LibTmux.Server type. |
| C++ | libtmux:: |
| Swift | Server |