tmuxtmuxCLI Manual

Choose documentation 1

3.2a

tmux manual version

Latest (3.7c) 3.7c 3.2a
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

tmux attach-session

If run from outside tmux, create a new client in the current terminal and attach it to target-session.

Syntax

tmux attach-session [-dErx] [-c working-directory] [-f flags] [-t target-session]

Alias: attach.

Behavior

If run from outside tmux, create a new client in the current terminal and attach it to target-session. If used from inside, switch the current client. If -d is specified, any other clients attached to the session are detached. If -x is given, send SIGHUP to the parent process of the client as well as detaching the client, typically causing it to exit. -f sets a comma-separated list of client flags. The flags are:
active-pane
the client has an independent active pane
ignore-size
the client does not affect the size of other clients
no-output
the client does not receive pane output in control mode
pause-after=seconds
output is paused once the pane is seconds behind in control mode
read-only
the client is read-only
wait-exit
wait for an empty line input before exiting in control mode

A leading ‘!’ turns a flag off if the client is already attached. -r is an alias for -f read-only,ignore-size. When a client is read-only, only keys bound to the detach-client or switch-client commands have any effect. A client with the active-pane flag allows the active pane to be selected independently of the window's active pane used by clients without the flag. This only affects the cursor position and commands issued from the client; other features such as hooks and styles continue to use the window's active pane.

If no server is started, attach-session will attempt to start it; this will fail unless sessions are created in the configuration file.

The target-session rules for attach-session are slightly adjusted: if tmux needs to select the most recently used session, it will prefer the most recently used session.

-c will set the session working directory (used for new windows) to working-directory.

If -E is used, the update-environment option will not be applied.

Guides

C implementation

Internal declarations in tmux 3.2a:

Use from a library

Each API describes its own defaults, errors and execution model.

tmux sources and license

Syntax comes from tmux 3.2a list-commands. See the global options for sockets and configuration, and command syntax and targets.

Behavior is taken from the tmux 3.2a manual.

Command declaration

Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Esc

Type to search.