# Server.hasSession(_:)

- **Module:** Server
- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-swift/blob/f02a4668570e1cc5198c941413750e021f42c214/Sources/LibTmux/Server.swift#L336
- **Page:** https://libtmux.org/reference/swift/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`
