> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/rtk-ai/rtk/llms.txt
> Use this file to discover all available pages before exploring further.

# rtk find

> Gitignore-aware file search with compact output

## Overview

Find files with intelligent filtering and gitignore support. Produces compact tree-style output instead of verbose line-by-line results.

## Syntax

```bash theme={null}
rtk find [OPTIONS] [PATH] [EXPRESSION]
```

## Options

Supports both RTK-specific and native `find` syntax:

**pattern** `string`

Glob pattern to match (e.g., `*.rs`, `test_*.py`)

**path** `string` (default: .)

Directory to search in

**-name \<pattern>** `string`

Native find: match filename pattern

**-type \<type>** `string`

Native find: file type (f=file, d=directory)

**-maxdepth \<n>** `number`

Native find: maximum search depth

## Examples

### Find by Pattern

```bash theme={null}
rtk find "*.rs"
```

**Output:**

```
Found 42 files:
src/
  main.rs
  lib.rs
  utils.rs
tests/
  integration.rs
  unit.rs
... +37 more
```

### Find with Native Syntax

```bash theme={null}
rtk find . -name "test_*.py" -type f
```

### Limit Depth

```bash theme={null}
rtk find "*.md" . -maxdepth 2
```

## Features

* **Gitignore-aware**: Automatically skips files in `.gitignore`
* **Grouped output**: Files organized by directory
* **Truncation**: Large result sets show summary with file count
* **Dual syntax**: Supports both simple glob patterns and native find flags

## Token Savings

Average token reduction: **80%**

For large projects with 1000+ matches, shows first 50 files + count summary instead of full list.

## Related Commands

* [rtk ls](/api/ls.md) - Directory listing
* [rtk grep](/api/grep.md) - Content search
* [rtk tree](/api/tree.md) - Directory tree

## Implementation

Source: `src/find_cmd.rs`

Uses `ignore` crate for gitignore support and intelligent file traversal.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.