# LibTmux.Server.DetachAllClientsAsync

- **Module:** LibTmux.Server
- **Package:** LibTmux
- **Language:** .NET
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/320dc64f4b8b7815842471327a5e6b84a1499bf8/src/LibTmux/Server.Clients.cs#L55
- **Page:** https://libtmux.org/en/dotnet/latest/reference/libtmux-server-detachallclientsasync/

```
LibTmux.Server.DetachAllClientsAsync(keepClient: string?, shellCommand: string?, cancellationToken: CancellationToken) -> Task
```

Detaches every client except one.

tmux reads the kept client from the same target flag it uses to name a
client, so this always spares one. Naming none does not mean "spare
none": tmux falls back to whichever client it resolves for the caller,
which from a process with no client of its own leaves that client
attached and detaches nothing.

## Parameters

- `keepClient` (string?): The client to leave attached.
- `shellCommand` (string?): A command the detached clients run.
- `cancellationToken` (CancellationToken): Cancels the tmux command.
