# LibTmux.Session.rename/4

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Elixir
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-elixir/blob/66b9b1c3f3f3186428abdfda2c76f5cf87446710/lib/libtmux/entities.ex#L77
- **Page:** https://libtmux.org/en/elixir/latest/reference/libtmux-session-rename-4/

```
rename(connection, ref, name, options \\ [])
@spec rename(
        LibTmux.Action.connection(),
        LibTmux.Ref.t(),
        binary(),
        [LibTmux.Control.call_option()]
      ) ::
        {:ok, LibTmux.Action.result(:ok)}
        | {:error, LibTmux.Action.error()}
```

Renames an exact session through the selected transport; returns an action result.

Names contain 1..1024 UTF-8 bytes without Unicode control characters (Cc).
Format syntax remains literal;
tmux still normalizes names (including dollar/backslash escaping, and dots
and colons on older releases). The only option is `timeout`, which defaults
to 5000ms.
Old observations stay unchanged. See `LibTmux.Action` for outcome semantics.

    alias LibTmux.Session

    Session.rename(server, session_ref, "work")

## Parameters

- `connection` (`LibTmux.Action.connection()`)
- `ref` (`LibTmux.Ref.t()`)
- `name` (`binary()`)
- `options` (`[LibTmux.Control.call_option()]`)
