> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fly.io/llms.txt
> Use this file to discover all available pages before exploring further.

# fly sprites attach

Attach to a running session, by session ID or by the command it is running.

Given a command, this attaches to the oldest session whose command starts with
it. Given nothing, it lists the sessions to pick from, and offers to open a
console when there are none.

## Usage

```
fly sprites attach [flags] [session-id|command]
```

## Examples

```
  fly sprites attach             # pick a session
  fly sprites attach 3           # attach to session 3
  fly sprites attach bash        # attach to the oldest session running bash
```

## Options

```
  -h, --help              help for attach
      --no-port-forward   Do not forward ports opened by the session to localhost
  -o, --org string        The target Fly.io organization
  -s, --sprite string     The target sprite. Defaults to the one set with 'fly sprites use'
```

## Global Options

```
  -t, --access-token string   Fly.io API token to use, overriding FLY_ACCESS_TOKEN, FLY_API_TOKEN and the saved login
      --debug                 Print additional logs and traces
      --verbose               Verbose output
```

## See Also

* [fly sprites](https://docs.fly.io/flyctl/cmd/fly_sprites)	 - Manage Sprites: persistent Linux environments for development and agents
