# tmux_window_link:link/3

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_window_link.erl#L87
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_window_link-link-3/

```
link(Link, Session, Options)
-spec link(tmux_model:window_link(),
           tmux_model:session(),
           placement_options()) ->
              {ok, tmux_operation:completed()} |
              {error, tmux_operation:failure()}.
```

Add another membership of this link's physical window to the destination session and explicit index. Defaults to detached and refuses an occupied index. replace = true maps to tmux -k and can destroy the occupied window. Returns the command result; use `get/3` to observe the new membership. The source membership remains. Session groups and renumber-windows retain their tmux semantics. Performs I/O after owner and membership checks.

## Parameters

- `Link` (`tmux_model:window_link()`)
- `Session` (`tmux_model:session()`)
- `Options` (`placement_options()`)

## tmux command

The tmux commands behind `link/3`.

- [`link-window`](/en/tmux/latest/manual/link-window/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_link_window_entry`](/en/tmux/latest/reference/c-variable-cmd_link_window_entry/) (attribute)
- [`cmd_move_window_exec`](/en/tmux/latest/reference/c-function-cmd-move-window-c-cmd_move_window_exec/) (function)

## In other ports

Link a window into another session

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Window.link`](/en/py/latest/reference/libtmux-window-link/) (method) |
| Ruby | [`LibTmux::Session#link_window`](/en/ruby/latest/reference/libtmux-session-link_window/) (method) |
| Lua | [`libtmux.WindowLink:link`](/en/lua/latest/reference/libtmux-windowlink-link/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`window.Window.link`](/en/ts/latest/reference/window-window-link/) (method) |
| Rust | [`window.Window.link_to`](/en/rs/latest/reference/window-window-link_to/) (method) |
| Go | [`tmux.Window.Link`](/en/go/latest/reference/tmux-window-link/) (method) |
| Java | [`io.github.libtmux.Window.linkTo`](/en/java/latest/reference/io-github-libtmux-window-window-linkto/) (method) |
| C# | [`LibTmux.Window.LinkAsync`](/en/csharp/latest/reference/libtmux-window-linkasync/) (method) |
| C++ | [`libtmux::Window::link_to`](/en/cxx/latest/reference/libtmux-window-link_to/) (method) |
| Swift | [`Server.link(_:into:)`](/en/swift/latest/reference/server-link(_-into-)/) (method) |
| OCaml | [`Libtmux_unix.Client.link_window`](/en/ocaml/latest/reference/libtmux_unix-client-link_window/) (function) |
| Perl | [`LibTmux::Server::link_window`](/en/perl/latest/reference/libtmux-server-link_window/) (method). Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes. |

No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.
