﻿# $ dotenvx ls

> List matching env files

[CLI](/docs/cli/)

```cli
$ dotenvx ls
```

[Watch demo](https://github.com/user-attachments/assets/e4be662b-7102-41ec-857a-c5d82f965885)

## Usage

```console
$ dotenvx ls
├─ .env.production
├─ .env
└─ apps
   └─ backend
      └─ .env
```

Pass a directory to list `.env` files under that path.

```console
$ dotenvx ls apps/backend
└─ .env
```

## JSON output

Use `--json` to print matching `.env` files as a JSON array of absolute filepaths.

```console
$ dotenvx ls --json
[
  "/path/to/project/.env",
  "/path/to/project/apps/backend/.env"
]
```

Progress and summary details are written to stderr, so stdout can be safely piped to another command or file.

```console
$ dotenvx ls --json > dotenv-files.json
```

Requires the ls build feature. Add it with [dotenvx install --add](/docs/cli/install-add/).

## Options

- [ls --file](/docs/cli/ls-f/)
- [ls --exclude-file](/docs/cli/ls-ef/)
- [ls --json](/docs/cli/ls-json/)

## Global options

- [--quiet](/docs/cli/quiet/)
- [--verbose](/docs/cli/verbose/)
- [--debug](/docs/cli/debug/)
- [--log-level](/docs/cli/log-level/)
