# Glob Tool

> The tool that finds files whose names match a pattern.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** Glob, **/*.js, File name pattern

## Think of it like

It is like asking for all the books with blue covers.

## Definition

The Glob tool finds files by their names, using a pattern such as **/*.js for every JavaScript file. It lists up to 100 files, newest first. It does not skip the files your .gitignore hides. On Windows it is on by default. On macOS and Linux, Claude Code leaves it out and Claude uses the find command through Bash instead. You get it back by naming it in --allowedTools.

## Example

Jack asks where the tests are. Claude searches for the pattern **/*.test.ts and gets a list of every test file in the project.

## Example code

```bash
claude --allowedTools "Glob" "Grep"
```

Bring Glob and Grep back on macOS or Linux.

## Why it matters

Finding the right files is the first step of almost any change.

## Common mistake

Expecting it to search inside files. Glob matches names only. Grep looks inside.

## Three principles

- **Names only.** Not contents.
- **Up to 100 files.** Newest first.
- **Off by default.** On macOS and Linux.

## Related terms

- [Grep Tool](https://learn.benibix.com/term/ai/grep-tool)
- [Read Tool](https://learn.benibix.com/term/ai/read-tool)
- [Bash Tool](https://learn.benibix.com/term/ai/bash-tool)

## Told apart from

- [Glob vs Grep](https://learn.benibix.com/compare/glob-tool-vs-grep-tool): People often think Glob and Grep both search inside files. Only Grep does. Glob matches file names, such as every file that ends in .ts. Grep looks inside the files for a word or a pattern. There is one more catch. Glob also finds the files .gitignore hides, while Grep skips them.

## Taught in

- [Claude Code File Tools](https://learn.benibix.com/learn/ai-claude-code/claude-code-file-tools): Claude Code, 9/16

![Glob finds files by name, Grep finds lines inside them, Read opens one, then Edit changes a part or Write replaces it all.](https://learn.benibix.com/diagrams/ct-file-tools.svg)

---

Source: https://learn.benibix.com/term/ai/glob-tool
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
