# Overview

> List, filter, view, and act on savings recommendations from the terminal.

Source: https://docs.levelfour.ai/cli/commands/recommendations


`l4 recommendations` lists pending savings recommendations and prints the full record for one.

`rec` and `recs` are aliases for `recommendations`, so `l4 rec accept REC-1234` and
`l4 recommendations accept REC-1234` are the same command.

## Subcommands

| Command                                            | Purpose                                         | Scope        |
| -------------------------------------------------- | ----------------------------------------------- | ------------ |
| [`list`](#list)                                    | Paginated, filterable list of recommendations   | `read`       |
| [`view`](#view)                                    | Full detail for one recommendation              | `read`       |
| [`accept`](/cli/commands/recommendations/accept)   | Record a decision to make the change            | `read-write` |
| [`reject`](/cli/commands/recommendations/reject)   | Close it, with an optional reason               | `read-write` |
| [`execute`](/cli/commands/recommendations/execute) | Request execution of an accepted recommendation | `read-write` |

## list

```bash
l4 recommendations list [flags]
```

### Flags

| Flag                             | Description                                                                                                        |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `--provider <id>`                | `aws`, `gcp`, `azure`, `k8s` (auto-detected if omitted)                                                            |
| `--service <s>`                  | Repeatable filter                                                                                                  |
| `--account <a>`                  | Repeatable filter                                                                                                  |
| `--environment <e>`              | Repeatable filter                                                                                                  |
| `--tag <t>`                      | Repeatable filter                                                                                                  |
| `--status <s>`                   | Repeatable: `available`, `pending`, `processing`, `optimized`, `rejected`, `unavailable`                           |
| `--search <q>`                   | Free-text search within current page                                                                               |
| `--sort-by <field>`              | `recommendation_id`, `service`, `environment`, `account`, `tag`, `monthly_savings`, `savings_percentage`, `status` |
| `--sort-order`                   | `asc` or `desc`                                                                                                    |
| `--page <n>` / `--page-size <n>` | Pagination. Defaults to 20 per page, 100 is the maximum                                                            |
| `--tui`                          | Open the interactive viewer                                                                                        |

Global flags apply. See [CLI overview](/cli#global-flags).

> **Warning**
>
> `--search` matches against the table the CLI prints, and only against the rows already on the page. A recommendation on page 4 stays invisible while you read page 1. It is also dropped under `--json`, `--jq` and `--template`, which return the whole page unfiltered, so a script that relies on it silently gets more rows than it asked for. Filter with `--service`, `--status`, `--account`, `--environment` or `--tag` instead: those go to the API.

`--tui` opens the list in the interactive viewer, with KPI cards and live filtering. [Filtering and sorting](/guides/filtering-and-sorting#interactive-tui) has its keys.

### Examples

```bash
l4 recommendations list
l4 recommendations list --service RDS --status available
l4 recommendations list --sort-by monthly_savings --sort-order desc
l4 recommendations list --page 2 --page-size 10
l4 recommendations list --provider gcp --environment production
l4 recommendations list --status available --jq '.data.data.items[] | .recommendation_id'
```

### JSON shape (relevant paths)

```text
.data.data.total_savings              # sum across the page
.data.data.items[]                    # array of recommendation rows
.data.data.items[].recommendation_id
.data.data.items[].service
.data.data.items[].monthly_savings
.data.data.items[].savings_percentage
.data.data.items[].status
.data.data.pagination.total_pages     # for pagination loops
.data.data.pagination.has_next
```

To walk every page and total the result, use [Aggregate 100% savings recommendations](/cli/recipes#aggregate-100-savings-recommendations).

## view

```bash
l4 recommendations view <id> [--tui]
```

`l4 recommendations view` prints the full record for one recommendation: description, monthly/annual savings, comparison against current spend, implementation steps, risk and rollback notes.

### Examples

```bash
l4 recommendations view REC-001
l4 recommendations view REC-001 --tui
l4 recommendations view REC-001 --json
l4 recommendations view REC-001 --web
```

In the TUI, use `Tab` / `Shift+Tab` to switch between Recommendation / Comparison / Risk panes, and the arrow keys to scroll within each tab.

Piping ids from `list` into `view` is [Fetch full detail for the top five recommendations](/cli/recipes#fetch-full-detail-for-the-top-five-recommendations).

## Related

* [Recipes](/cli/recipes): the multi-page pipelines built on `list`
* [Filtering and sorting](/guides/filtering-and-sorting): the TUI keys and the `--jq` quirks
* [Recommendations API](/api-reference/recommendations): the endpoints underneath
