# Server.hasSession(_:)

- **Module:** Server
- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/Server.swift#L362
- **Page:** https://libtmux.org/en/swift/latest/reference/server-hassession(_-)/

```
Server.hasSession(_:)(name: String) -> Bool
```

Whether a session by this name or id exists.

Asks the question tmux has a command for rather than listing every
session and searching one: `has-session` answers with its exit status,
so this decodes nothing and stays correct for a name a listing would
have to be parsed to find.

## Raises

- `TmuxError`
