📖 Guide

Find — Complete Reference

Comprehensive find cheat sheet covering name, type, size, time, permission filters, actions, combined expressions, and common patterns.

58 commands across 9 categories

Basic Usage

CommandDescription
find .
List all files and directories recursively from current directory
find /path/to/dir
Search starting from a specific directory
find . -maxdepth 1
Limit search to current directory only (no recursion)
find . -mindepth 2
Skip the first level; start searching from depth 2
find . -maxdepth 3 -mindepth 2
Search only at depth 2 and 3
find . -follow
Follow symbolic links during search

By Name

CommandDescription
find . -name '*.txt'
Find files matching a glob pattern (case-sensitive)
find . -iname '*.jpg'
Find files matching pattern (case-insensitive)
find . -name '*.log' -not -name 'error.*'
Match one pattern but exclude another
find . -path '*/src/*.ts'
Match against the full path, not just filename
find . -regex '.*\.[ch]pp$'
Match filename using full regex
find . -name '.*'
Find hidden files (dotfiles)

By Type

CommandDescription
find . -type f
Find regular files only
find . -type d
Find directories only
find . -type l
Find symbolic links only
find . -type f -empty
Find empty files
find . -type d -empty
Find empty directories
find . -type f -executable
Find executable files (GNU find)

By Size

CommandDescription
find . -size +100M
Find files larger than 100 MB
find . -size -1k
Find files smaller than 1 KB
find . -size 0
Find zero-byte files
find . -size +1G
Find files larger than 1 GB
find . -size +10M -size -100M
Find files between 10 MB and 100 MB
find . -type f -size +50M -exec ls -lh {} +
List large files with human-readable sizes

By Time

CommandDescription
find . -mtime -7
Files modified in the last 7 days
find . -mtime +30
Files modified more than 30 days ago
find . -atime -1
Files accessed in the last 24 hours
find . -ctime -7
Files with status changed in the last 7 days
find . -mmin -60
Files modified in the last 60 minutes
find . -newer reference.txt
Files modified more recently than reference.txt
find . -newermt '2024-01-01'
Files modified after a specific date (GNU find)

By Permissions

CommandDescription
find . -perm 644
Find files with exact permissions 644
find . -perm -u+x
Find files where owner has execute permission
find . -perm /o+w
Find files where others have write permission
find . -user root
Find files owned by root
find . -group staff
Find files owned by group 'staff'
find . -nouser
Find files with no matching user in /etc/passwd
find . -perm -4000
Find setuid files (potential security concern)

Actions

CommandDescription
find . -name '*.tmp' -delete
Delete matching files (use with caution!)
find . -type f -exec chmod 644 {} \;
Run command on each file (\; runs once per file)
find . -type f -exec chmod 644 {} +
Run command with multiple files at once (more efficient)
find . -name '*.log' -exec rm -i {} \;
Interactive delete (asks for each file)
find . -name '*.js' -print0 | xargs -0 wc -l
Pipe to xargs with null delimiter (handles spaces in names)
find . -type f -ok mv {} /backup/ \;
Like -exec but prompts for confirmation on each file
find . -name '*.txt' -exec grep -l 'pattern' {} +
Find files containing a specific pattern

Combining Expressions

CommandDescription
find . -name '*.js' -o -name '*.ts'
OR: match .js or .ts files
find . -name '*.log' -a -size +1M
AND: match .log files larger than 1 MB (default operator)
find . ! -name '*.txt'
NOT: exclude .txt files
find . \( -name '*.js' -o -name '*.ts' \) -newer ref.txt
Group expressions with parentheses
find . -name '*.bak' -prune -o -name '*.txt' -print
Exclude a pattern from results using -prune
find . -path './node_modules' -prune -o -name '*.js' -print
Skip node_modules directory entirely

Common Patterns

CommandDescription
find . -name 'node_modules' -type d -prune -exec rm -rf {} +
Recursively delete all node_modules directories
find . -type f -name '*.py' | wc -l
Count Python files in a project
find . -type f -mtime +90 -delete
Clean up files older than 90 days
find . -type f -printf '%s %p\n' | sort -rn | head -20
Find 20 largest files with sizes (GNU find)
find . -type l ! -exec test -e {} \; -print
Find broken symbolic links
find . -type f -name '*.jpg' -exec cp {} /backup/photos/ \;
Copy all JPG files to a backup directory
find /var/log -name '*.gz' -mtime +30 -delete
Clean up old compressed log files

More Guides

🌿
Git Commands
Complete Git command reference — from basics to advanced workflows. Searchable, with examples.
📝
Vim Commands
Complete Vim/Vi command reference — modes, motions, editing, search, and advanced features.
🐳
Docker Commands
Complete Docker & Docker Compose command reference — containers, images, volumes, networks, and orchestration.
🔤
Regex Reference
Complete regular expression reference — syntax, patterns, quantifiers, groups, lookaheads, and common recipes.
🐧
Linux Commands
Complete Linux/Bash command reference — file management, text processing, networking, system admin, and shell scripting.
☸️
Kubernetes Commands
Complete Kubernetes & kubectl command reference — pods, deployments, services, configmaps, and cluster management.
🐍
Python Reference
Complete Python reference — syntax, data structures, string methods, file I/O, comprehensions, and common patterns.
🗃️
SQL Reference
Complete SQL reference — queries, joins, aggregation, subqueries, indexes, and database management.
🌐
Nginx Reference
Complete Nginx configuration reference — server blocks, locations, proxying, SSL, load balancing, and caching.
🔐
SSH Commands
Complete SSH reference — connections, key management, tunneling, config, SCP/SFTP, and security hardening.
👷
Jenkins Reference
Complete Jenkins reference — pipeline syntax, Jenkinsfile, plugins, CLI, agents, and CI/CD patterns.
📨
HTTP Headers Reference
Complete HTTP headers reference — request headers, response headers, caching, security, CORS, and content negotiation. Searchable, with examples.
🐘
PostgreSQL Reference
Comprehensive PostgreSQL reference — from connection basics to advanced features like JSONB, full-text search, window functions, and performance tuning.
Async Patterns Reference
Multi-language async/concurrency patterns — JavaScript, Python, Go, Rust, Java, and universal concurrency patterns.
📡
Protobuf & gRPC Reference
Comprehensive reference for Protocol Buffers (proto3) and gRPC — message definitions, services, streaming, and common patterns.
📚
JS Array Methods
Complete JavaScript Array methods reference — creating, searching, transforming, sorting, iterating, and common patterns. Searchable, with examples.
🌊
Tailwind CSS Reference
Complete Tailwind CSS reference — layout, spacing, typography, colors, responsive design, states, and common patterns. Searchable, with examples.
GraphQL Reference
Complete GraphQL reference — schema definition, types, queries, mutations, directives, fragments, and common patterns. Searchable, with examples.
💻
VS Code Shortcuts
Complete VS Code keyboard shortcuts — editing, navigation, search, multi-cursor, terminal, debug, and more. Searchable, with Cmd/Ctrl notation.
🔲
CSS Grid Reference
Complete CSS Grid reference — container properties, item placement, grid functions, and common layout patterns. Searchable, with examples.
📦
CSS Flexbox Reference
Complete CSS Flexbox reference — container properties, item properties, and common layout patterns. Searchable, with examples.
⚛️
React Hooks Reference
Complete React Hooks reference — useState, useEffect, useContext, custom hooks, and common patterns. Searchable, with examples.
🔷
TypeScript Reference
Complete TypeScript reference — types, interfaces, generics, utility types, and advanced patterns. Searchable, with examples.
☁️
AWS CLI Reference
Complete AWS CLI reference — EC2, S3, IAM, Lambda, ECS, RDS, CloudFormation, and common operations.
🐹
Go Reference
Complete Go (Golang) reference — syntax, types, functions, concurrency, error handling, and common patterns.
💠
PowerShell Reference
Complete PowerShell reference — cmdlets, pipelines, scripting, file operations, remote management, and Active Directory.
💾
Redis Commands
Complete Redis command reference — strings, hashes, lists, sets, sorted sets, pub/sub, transactions, and server management.
🏗️
Terraform Commands
Complete Terraform reference — init, plan, apply, state management, modules, workspaces, and HCL syntax.
⚙️
Ansible Commands
Complete Ansible reference — playbooks, modules, inventory, roles, vault, and ad-hoc commands.
🟨
JavaScript
Complete JavaScript reference — variables, types, operators, strings, arrays, objects, functions, async, DOM, ES6+, and more.
🎨
CSS
Complete CSS reference — selectors, box model, positioning, typography, animations, media queries, custom properties, and more.
📄
HTML
Complete HTML reference — document structure, text content, forms, media, semantic elements, accessibility, and more.
Java
Complete Java reference — data types, strings, collections, OOP, interfaces, exceptions, file I/O, streams, lambdas, and more.
💻
Bash
Complete Bash reference — variables, strings, arrays, conditionals, loops, functions, file tests, I/O redirection, process management, and more.
🦀
Rust
Comprehensive Rust language cheat sheet covering ownership, traits, pattern matching, concurrency, and more.
📝
Markdown
Complete Markdown syntax reference for headings, formatting, links, tables, code blocks, and extensions.
📋
YAML
YAML syntax reference covering scalars, collections, anchors, multi-line strings, and common patterns.
🌐
Curl
Curl command-line reference for HTTP requests, authentication, file transfers, debugging, and common API patterns.
Cron
Cron scheduling reference covering syntax, field values, crontab management, and common schedule patterns.
🖥️
Tmux
Terminal multiplexer for managing multiple sessions, windows, and panes from a single terminal.
🔧
Awk
Powerful text processing language for pattern scanning, data extraction, and report generation.
✂️
Sed
Stream editor for filtering and transforming text, line by line.

📖 Free, searchable command reference. Bookmark this page for quick access.