glob pattern
A pattern that matches names using * for any run of characters, a question mark for one character and [abc] for one of a set.
In more detail
Shells expand glob patterns into matching file names before running a command, and many tools, such as ignore files and test runners, use the same patterns to select files. Many tools also accept ** to match any number of folders, as in src/**/*.ts. A glob is simpler than a regular expression: a star in a glob means anything, while in a regular expression it means repeat the previous item. Quote a pattern on the command line when the program, not the shell, should expand it.
Examples
ls *.mdfind . -name "*.log"turbo.json outputs: ["dist/**", ".next/**"]*.logdocs/**/scratch.md (Git adds ** for any number of directories)Path(".").glob("*.py") in Python; the glob module does the same with strings."include": ["src/**/*"]Related terms
- globbing — The step where bash replaces a word containing a star, a question mark or square brackets with the sorted list of file names that match it.
- regular expression — A pattern language for matching text, where characters such as ., *, ^ and $ have special meanings.
- case statement — A statement that compares one value against several glob patterns and runs the block for the first that matches.
- find command — The find command, which walks a directory tree and prints, or acts on, every entry that passes its tests.
- event filter — Keys under an event, such as branches, tags and paths, that narrow which pushes or pull requests start a workflow.
- upload-artifact action — The official action that uploads files from a job to artifact storage under a name, so later jobs or people can download them.
- Turborepo — A build tool for JavaScript monorepos that runs package tasks in dependency order, in parallel, and skips work whose inputs have not changed.
- hash — A short fixed-length fingerprint calculated from data, which changes completely if even one byte of the data changes.
- .gitignore — A text file of patterns naming untracked files Git should not report or add, such as build output and logs.
- matcher (middleware) — The config.matcher option exported from middleware.ts that lists which paths the middleware runs on.
- test runner — A tool that finds test files, runs the tests in them and reports which passed and which failed.
- pathlib — Python's standard library module for working with file paths as objects rather than plain strings.
- iterdir() — The Path method that yields the entries, files and folders, inside a directory.
- include and exclude — The tsconfig.json lists of file patterns that decide which source files belong to the project.
Taught in
- What Bash Does To A Line Before It Runs It — Bash Scripting & Command Line Automation
- Trimming, Replacing And Changing Case — Bash Scripting & Command Line Automation
- Conditionals: test, Brackets, Double Brackets, case — Bash Scripting & Command Line Automation
- Loops: for, while, until, break, continue — Bash Scripting & Command Line Automation
- find And xargs — Bash Scripting & Command Line Automation
- Triggers and the Event Model — Continuous Integration & Continuous Delivery Pipelines
- Passing Data Between Jobs: Artifacts — Continuous Integration & Continuous Delivery Pipelines
- Unified Build Pipelines: Caching & Dependency Graphs — Production Full-Stack Engineering
- Ignoring Files, And The Tracked File Trap — Advanced Git Internals & Distributed Workflows
- Edge Middleware: Auth Verification & Route Matchers — Next.js 15 & Modern App Router Architecture
- Native Test Runner: node:test & node:assert/strict — Node.js Internals & Backend Services
- A Standard Library Tour — Hands-on Python: Complete Video Course & Book
- tsconfig.json: target, lib, strict And NodeNext — Production TypeScript
- The Cleanup That Emptied The Wrong Directory: Shell Scripts Under Exam Conditions — CompTIA Linux+ (XK0-006) Exam Prep
- Sixty Questions, One Wrong Flag Each — LPIC-1 Linux Administrator (101-500 and 102-500) Exam Prep
References
- Bash Reference Manual: Pattern Matching
- POSIX: Pattern Matching Notation
- glob(7) manual page
- GitHub Docs: Workflow syntax for GitHub Actions
- Turborepo: Configuring tasks (inputs and outputs)
- Git reference: gitignore (pattern format)
- Node.js: File system (fsPromises.glob)
- glob documentation
- TSConfig: include