# tmux_session:rename_command/2

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_session.erl#L93
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_session-rename_command-2/

```
rename_command(Session, Name)
-spec rename_command(tmux_model:session(), binary()) ->
                        {ok, tmux_command:t()} |
                        {error, map()}.
```

Build a literal rename command without tmux I/O. Validates the row and keeps its captured origin; endpoint liveness is checked during execution. Submit the value to `tmux_server:command/3` or `tmux_operation:start/3` with its original endpoint. Existing session records retain their captured name.

Detached rows require `tmux_server:bind/2` first. Building a command does not
execute it or make a repeated mutation safe.

## Examples

```erlang
1> tmux_session:rename_command(invalid_row, <<"work">>).
{error,#{code => invalid_row,path => []}}
```

## Parameters

- `Session` (`tmux_model:session()`)
- `Name` (`binary()`)
