FindUtils.com is not the GNU findutils package. This article is a cheatsheet for the GNU find, xargs, locate, and updatedb commands, plus web-tool alternatives on this site.

GNU findutils is the backbone of file searching and batch processing on Linux and Unix systems. The package includes four core commands — find, locate, updatedb, and xargs — that handle everything from locating files by name to executing complex batch operations across thousands of files. This cheatsheet covers every major use case across Linux, macOS, and Windows, plus a mapping to free web-based alternatives at findutils.com for when you need a browser-based solution.

Whether you're a sysadmin hunting down rogue log files, a developer cleaning up build artifacts, or a security engineer auditing file permissions — this is your single reference for all findutils operations.

What Is GNU Findutils?

GNU findutils is a collection of four command-line utilities that search for and process files on Unix-like operating systems. Every major Linux distribution includes findutils by default, and macOS ships with BSD versions of the same commands. Here's what each command does:

CommandPurposeSpeedRequires Root?
findSearch files in real-time by traversing directoriesSlower (live scan)No (but some dirs need it)
locateSearch files from a pre-built databaseVery fast (database lookup)No
updatedbRebuild the database used by locateN/A (maintenance)Yes (usually)
xargsBuild and execute commands from standard inputN/A (command builder)Depends on command

Installing Findutils by Platform

Findutils comes pre-installed on most systems, but here's how to install or update it on each platform.

Linux

1
2
3
4
5
6
7
8
9
10
11
# Debian/Ubuntu
sudo apt install findutils

# Fedora/RHEL
sudo dnf install findutils

# Arch Linux
sudo pacman -S findutils

# Check version
find --version

macOS

macOS ships with BSD find, which has slightly different flags. To get GNU findutils (recommended for full compatibility):

1
2
3
4
5
6
7
# Install via Homebrew
brew install findutils

# GNU versions are prefixed with 'g'
gfind --version # GNU find
gxargs --version # GNU xargs
glocate --version # GNU locate

Tip: Add GNU findutils to your PATH to use them without the g prefix:

export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"

Windows

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Option 1: WSL (Windows Subsystem for Linux)
wsl sudo apt install findutils

# Option 2: Git Bash (ships with find and xargs)
# Already included — just open Git Bash

# Option 3: Cygwin
# Select findutils during Cygwin setup

# Option 4: MSYS2
pacman -S findutils

# Windows native equivalent
where /R C:\ filename.txt # Similar to find -name
dir /S /B *.txt # Recursive file listing

The find Command — Complete Cheatsheet

The find command is the most powerful and versatile tool in findutils. It searches the filesystem in real-time, applying filters and executing actions on matches.

Basic Syntax

find [path] [options] [expression]

Finding Files by Name

CommandDescription
find . -name "file.txt"Find exact filename (case-sensitive)
find . -iname "file.txt"Find filename (case-insensitive)
find . -name "*.json"Find all JSON files
find . -name "*.log" -o -name "*.tmp"Find .log OR .tmp files
find / -name "nginx.conf"Search entire system for nginx.conf
find . -not -name "*.txt"Find all files EXCEPT .txt
find . -name "report-[0-9]*"Find files matching glob pattern

Finding Files by Type

CommandDescription
find . -type fFind regular files only
find . -type dFind directories only
find . -type lFind symbolic links only
find . -type f -name "*.sh"Find shell scripts (files only)
find . -type d -name "node_modules"Find all node_modules directories
find . -type f -emptyFind empty files
find . -type d -emptyFind empty directories

Finding Files by Size

CommandDescription
find . -size +100MFiles larger than 100 MB
find . -size -1kFiles smaller than 1 KB
find . -size +1GFiles larger than 1 GB
find . -size 0Zero-byte files
find . -size +50M -size -200MFiles between 50-200 MB
find /var/log -size +500M -type fLarge log files

Size suffixes: c (bytes), k (kilobytes), M (megabytes), G (gigabytes)

Finding Files by Time

CommandDescription
find . -mtime -7Modified in the last 7 days
find . -mtime +30Modified more than 30 days ago
find . -mmin -60Modified in the last 60 minutes
find . -atime -1Accessed in the last 24 hours
find . -ctime -7Status changed in the last 7 days
find . -newer reference.txtModified after reference.txt
find . -mtime +365 -type fFiles not modified in over a year

Time units: -mtime (days), -mmin (minutes), -atime (access time), -ctime (change time)

Finding Files by Permissions and Ownership

CommandDescription
find . -perm 644Files with exact permission 644
find . -perm -u+xFiles executable by owner
find . -perm /o+wFiles writable by others (security risk)
find / -perm -4000Find SUID files (security audit)
find . -user www-dataFiles owned by www-data
find . -group developersFiles owned by group "developers"
find . -nouserFiles with no valid owner
find . -nogroupFiles with no valid group

Finding Files by Depth

CommandDescription
find . -maxdepth 1 -type fOnly current directory (no recursion)
find . -maxdepth 2 -name "*.txt"Current dir + 1 level deep
find . -mindepth 2 -type fSkip current dir, start 2 levels deep
find . -maxdepth 3 -mindepth 2Only 2-3 levels deep

Executing Actions on Found Files

This is where find becomes incredibly powerful — executing commands on every match.

CommandDescription
find . -name "*.tmp" -deleteDelete all .tmp files
find . -name "*.log" -exec rm {} \;Delete using exec (one by one)
find . -name "*.log" -exec rm {} +Delete using exec (batched, faster)
find . -type f -exec chmod 644 {} +Set permissions on all files
find . -type d -exec chmod 755 {} +Set permissions on all directories
find . -name "*.txt" -exec grep -l "error" {} +Find .txt files containing "error"
find . -name "*.jpg" -exec cp {} /backup/ \;Copy all JPGs to backup
find . -name "*.bak" -exec mv {} /archive/ \;Move all .bak files to archive
find . -type f -exec ls -lh {} + | sort -k5 -hList files sorted by size

Excluding Directories

CommandDescription
find . -path ./node_modules -prune -o -name "*.js" -printSkip node_modules
find . -not -path "./.git/*" -name "*.py"Exclude .git directory
find . -path ./vendor -prune -o -path ./node_modules -prune -o -type f -printSkip multiple dirs

Combining Conditions

CommandDescription
find . -name "*.js" -and -size +100kAND condition (both must match)
find . -name "*.jpg" -or -name "*.png"OR condition (either matches)
find . -not -name "*.log"NOT condition (negate)
find . \( -name "*.css" -o -name "*.js" \) -mtime -7Grouped OR with time filter

Advanced find Recipes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Find duplicate files by size (potential duplicates)
find . -type f -exec ls -lS {} + | awk '{print $5, $NF}' | sort -n | uniq -d -w 10

# Find and count files by extension
find . -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -20

# Find files modified today
find . -type f -daystart -mtime 0

# Find broken symlinks
find . -xtype l

# Find largest 10 directories
find . -type d -exec du -sh {} + 2>/dev/null | sort -rh | head -10

# Find world-writable files (security audit)
find / -type f -perm -0002 -ls 2>/dev/null

# Find files with specific content and replace
find . -name "*.txt" -exec sed -i 's/old/new/g' {} +

# Find recently modified config files
find /etc -name "*.conf" -mmin -30 -type f

The locate command searches a pre-built database of filenames, making it 10-100x faster than find for simple name searches. The tradeoff: it doesn't see files created since the last database update.

Basic Usage

CommandDescription
locate filename.txtFind files matching "filename.txt"
locate -i READMECase-insensitive search
locate "*.json"Find all JSON files in database
locate -c "*.pdf"Count matching files (don't list)
locate -l 10 "*.log"Show only first 10 results
locate -r '\.py$'Use regex pattern matching
locate --existing "*.conf"Only show files that still exist
locate -SShow database statistics

macOS Differences

macOS uses a different locate implementation:

1
2
3
4
5
6
# Update the database on macOS
sudo /usr/libexec/locate.updatedb

# Or with GNU locate (from Homebrew findutils)
gupdatedb
glocate filename

Windows Equivalent

Windows doesn't have locate, but you can use:

1
2
3
4
5
6
7
8
# Windows Search from command line
where /R C:\ *.json

# PowerShell equivalent
Get-ChildItem -Path C:\ -Recurse -Filter "*.json" -ErrorAction SilentlyContinue

# Using Everything (third-party, very fast)
es.exe "*.json"

The updatedb Command — Database Maintenance

updatedb rebuilds the file database used by locate. Most systems run it automatically via a daily cron job.

CommandDescription
sudo updatedbUpdate the entire database
updatedb --localpaths='/home /var'Only index specific paths
updatedb --prunepaths='/tmp /proc /sys'Exclude specific paths
updatedb --prunefs='NFS nfs'Exclude filesystem types
updatedb --output=/tmp/mydb.dbWrite to custom database file
locate -d /tmp/mydb.db patternUse custom database for search

Configuration File

The default configuration is at /etc/updatedb.conf:

1
2
3
4
# Common /etc/updatedb.conf settings
PRUNE_BIND_MOUNTS="yes"
PRUNEPATHS="/tmp /var/spool /media /mnt"
PRUNEFS="NFS nfs nfs4 rpc_pipefs afs binfmt_misc"

The xargs Command — Batch Command Builder

xargs reads items from standard input and executes a command with those items as arguments. It's the glue that makes find pipelines truly powerful.

Basic Usage

CommandDescription
find . -name "*.log" | xargs rmDelete found files
find . -name "*.txt" | xargs grep "error"Search content in found files
find . -name "*.jpg" | xargs -I {} cp {} /backup/Copy each file (with placeholder)
cat urls.txt | xargs wgetDownload all URLs from file
echo "1 2 3 4 5" | xargs -n 2Group args in pairs
find . -name "*.gz" | xargs -P 4 gunzipParallel decompression (4 jobs)

Handling Filenames with Spaces

This is the #1 gotcha with xargs. Always use null-delimited input for safety:

1
2
3
4
5
6
7
8
# SAFE: Use -print0 and -0 together
find . -name "*.txt" -print0 | xargs -0 rm

# SAFE: Use -I with placeholder
find . -name "*.txt" | xargs -I {} mv {} /backup/

# UNSAFE: Will break on spaces in filenames
find . -name "*.txt" | xargs rm # DON'T DO THIS

xargs Flags Reference

FlagDescriptionExample
-0Input delimited by null charsfind . -print0 | xargs -0 ls
-I {}Replace placeholder with each itemxargs -I {} cp {} /dest/
-n NMax N arguments per commandxargs -n 1 echo
-P NRun N parallel processesxargs -P 8 gzip
-pPrompt before each executionxargs -p rm
-tPrint command before executingxargs -t chmod 644
-L NMax N lines per commandxargs -L 1 command
--max-procsSame as -P (GNU)xargs --max-procs=4
--no-run-if-emptySkip if no input (GNU)xargs --no-run-if-empty rm

Advanced xargs Recipes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Parallel file compression (8 cores)
find . -name "*.log" -print0 | xargs -0 -P 8 gzip

# Batch rename files
find . -name "*.jpeg" | xargs -I {} bash -c 'mv "$1" "${1%.jpeg}.jpg"' _ {}

# Download URLs in parallel
cat urls.txt | xargs -P 5 -I {} wget -q {}

# Count lines in all Python files
find . -name "*.py" | xargs wc -l | tail -1

# Run eslint on changed files only
git diff --name-only -- '*.js' | xargs eslint

# Batch image resize with ImageMagick
find . -name "*.png" -print0 | xargs -0 -P 4 -I {} convert {} -resize 50% {}

Cross-Platform Comparison Table

Not every command works the same on every OS. Here's a quick reference:

OperationLinuxmacOS (BSD)macOS (GNU)Windows (PowerShell)
Find by namefind . -name "*.txt"find . -name "*.txt"gfind . -name "*.txt"Get-ChildItem -Recurse -Filter *.txt
Case-insensitivefind . -iname "*.txt"find . -iname "*.txt"gfind . -iname "*.txt"Get-ChildItem -Recurse -Filter *.txt (default)
Find by sizefind . -size +100Mfind . -size +100Mgfind . -size +100MGet-ChildItem -Recurse | Where {$_.Length -gt 100MB}
Find by datefind . -mtime -7find . -mtime -7gfind . -mtime -7Get-ChildItem -Recurse | Where {$_.LastWriteTime -gt (Get-Date).AddDays(-7)}
Delete foundfind . -name "*.tmp" -deletefind . -name "*.tmp" -deletegfind . -name "*.tmp" -deleteGet-ChildItem -Recurse -Filter *.tmp | Remove-Item
Locate filelocate filelocate fileglocate filewhere /R C:\ file
Update DBsudo updatedbsudo /usr/libexec/locate.updatedbgupdatedbN/A
Null-safe xargsxargs -0xargs -0gxargs -0ForEach-Object {}

CLI Commands vs FindUtils.com Web Tools

Many operations that traditionally require find + command-line tools can now be done instantly in the browser. This table maps common find + exec/xargs pipelines to their free web-based equivalents on findutils.com — no terminal required.

File Format Processing

CLI CommandWhat It DoesWeb Alternative
find . -name "*.json" -exec python -m json.tool {} \;Format/beautify JSON filesJSON Formatter
find . -name "*.json" -exec jq -c '.' {} \;Minify JSON filesJSON Minifier
find . -name "*.json" -exec diff {} \;Compare JSON filesJSON Comparer
find . -name "*.html" -exec tidy -i {} \;Format HTML filesHTML Formatter
find . -name "*.xml" -exec xmllint --format {} \;Format XML filesXML Formatter
find . -name "*.sql" -exec sqlformat {} \;Format SQL filesSQL Formatter
find . -name "*.css" -exec cleancss {} \;Minify CSS filesCSS Minifier
find . -name "*.yaml" -exec yamllint {} \;Validate YAML filesYAML Validator
find . -name "*.md" -exec grip {} \;Preview MarkdownMarkdown Previewer

Data Conversion

CLI CommandWhat It DoesWeb Alternative
find . -name "*.csv" | xargs csvjsonConvert CSV to JSONCSV to JSON
find . -name "*.json" | xargs json2csvConvert JSON to CSVJSON to CSV
find . -name "*.json" -exec yq -p json -o yaml {} \;Convert JSON to YAMLJSON-YAML Converter
find . -name "*.xml" -exec xml2json {} \;Convert XML to JSONXML to JSON
find . -name "*.json" -exec json2xml {} \;Convert JSON to XMLJSON to XML
find . -name "*.html" | xargs html2mdConvert HTML to MarkdownHTML to Markdown
find . -name "*.csv" | xargs xlsxConvert CSV to ExcelCSV to Excel
find . -name "*.xlsx" | xargs csv-exportConvert Excel to CSVExcel to CSV
find . -name "*.docx" | xargs libreoffice --convert-to pdfConvert Word to PDFWord to PDF
find . -name "*.pptx" | xargs libreoffice --convert-to pdfConvert PPTX to PDFPPTX to PDF

Security & Hashing

CLI CommandWhat It DoesWeb Alternative
find . -type f -exec md5sum {} +Generate MD5 hashesMD5 Hash Generator
find . -type f -exec sha256sum {} +Generate SHA-256 hashesSHA-256 Hash Generator
find . -type f -exec sha256sum {} + | diff - checksums.txtCompare file hashesHash Comparison Tool
find . -name "*.jpg" -exec exiftool -all= {} +Strip EXIF metadata from imagesEXIF Remover
find . -name "*.pem" -exec openssl x509 -text {} \;Inspect SSL certificatesSSL Certificate Checker
find . -name "*.jwt" -exec jwt decode {} \;Decode JWT tokensJWT Decoder
find . -type f -exec openssl enc -aes-256-cbc {} \;Encrypt filesText Encryption
find / -perm -4000 -type f -lsSecurity audit (SUID files)Security Headers Analyzer

Image & Media Processing

CLI CommandWhat It DoesWeb Alternative
find . -name "*.jpg" | xargs -P 4 convert -resize 800xBatch resize imagesImage Resizer
find . -name "*.png" | xargs -P 4 pngquant --quality=65-80Compress imagesImage Compressor
find . -name "*.png" | xargs -I {} convert {} {}.jpgConvert image formatsImage Converter
find . -name "*.mp4" | xargs ffmpeg -i {} -an audio.mp3Extract audio from videoVideo to Audio
find . -name "*.mp4" | xargs ffmpeg -t 5 -vf "fps=10"Convert video to GIFVideo to GIF
find . -name "*.png" | xargs base64Convert images to Base64Image to Base64

Text Analysis

CLI CommandWhat It DoesWeb Alternative
find . -name "*.txt" | xargs wc -wCount words in filesWord Counter
find . -name "*.txt" | xargs wc -cCount characters in filesCharacter Counter
find . -name "*.txt" -exec grep -E "pattern" {} +Regex search across filesRegex Tester
find . -name "*.txt" -exec diff {} \;Compare text filesDiff Checker
find . -name "*.md" -exec cat {} + | wc -wCalculate reading timeReading Time Estimator
find . -name "*.txt" -exec sort {} \;Sort lines in filesText Line Sorter

PDF Operations

CLI CommandWhat It DoesWeb Alternative
find . -name "*.pdf" | xargs pdfunite output.pdfMerge PDF filesPDF Merger
find . -name "*.pdf" -exec pdfseparate {} page-%d.pdf \;Split PDF pagesPDF Split
find . -name "*.pdf" | xargs gs -dPDFSETTINGS=/ebookCompress PDFsPDF Compress
find . -name "*.pdf" -exec pdftk {} cat 1-endeast output rotated.pdf \;Rotate PDF pagesPDF Rotate

Developer Workflows

CLI CommandWhat It DoesWeb Alternative
find . -name "*.ts" -exec quicktype --src {} \;Generate TypeScript types from JSONJSON to TypeScript
find . -name "*.json" -exec jsonschema {} \;Validate JSON SchemaJSON Schema Validator
find . -name "*.json" -exec jq '.' {} \;Query JSON with jqjq Playground
find . -name "*.csv" -exec cat {} \;View CSV dataCSV Viewer
find . -name "*.har" -exec har2curl {} \;Convert HAR to cURLHAR to cURL
find . -name "*.json" -exec json-diff {} \;Diff JSON files side by sideJSON Diff
date -d @1700000000Convert Unix timestampsUnix Timestamp
find . -name "*.json" -exec base64 {} \;Encode/decode Base64Base64 Encoder
find . -name "*.json" -exec jsonpath {} '$.key' \;Query JSON pathsJSON Path Finder

When to Use CLI vs Web Tools

Both command-line findutils and browser-based tools have their place. Here's a decision matrix:

ScenarioBest ChoiceWhy
Processing 1,000+ files in batchCLI (find + xargs)Automation and speed at scale
Quick one-off formattingWeb toolNo setup, instant results
Automated CI/CD pipelineCLIScriptable, repeatable
Sharing results with non-technical teamWeb toolNo terminal needed
Files already on your serverCLINo upload required
Restricted dataYour approved local workflowFollow the data-handling policy and check the tool’s data path
Complex regex across many filesCLI (find + grep)Raw speed
Testing a single regex patternRegex TesterVisual feedback, match highlighting
Comparing two JSON configsJSON ComparerVisual diff, side-by-side view
Batch image resize for productionCLI (find + convert)Scriptable
Quick image resize for social mediaImage ResizerPreset dimensions, instant preview

FindUtils tools have different data paths. A local formatter differs from a remote lookup or shared-note service. Use redacted examples for API keys and private configuration. A browser interface alone does not establish safe handling.


Common Mistakes and How to Fix Them

Mistake 1: Forgetting Quotes Around Patterns

1
2
3
4
5
# WRONG — shell expands the glob before find sees it
find . -name *.txt

# CORRECT — quotes prevent premature expansion
find . -name "*.txt"

Mistake 2: Using xargs Without Null-Delimiter on Files with Spaces

1
2
3
4
5
# WRONG — breaks on "My Document.txt"
find . -name "*.txt" | xargs rm

# CORRECT — null-delimited, handles any filename
find . -name "*.txt" -print0 | xargs -0 rm

Mistake 3: Using -exec with ; When + Is Faster

1
2
3
4
5
# SLOW — spawns one process per file
find . -name "*.log" -exec grep "error" {} \;

# FAST — batches files into fewer processes
find . -name "*.log" -exec grep "error" {} +

Mistake 4: Forgetting -prune and Searching Unnecessary Directories

1
2
3
4
5
# SLOW — searches inside .git, node_modules, etc.
find . -name "*.js"

# FAST — skips heavy directories
find . -path ./node_modules -prune -o -path ./.git -prune -o -name "*.js" -print

Mistake 5: Running updatedb Without Proper Exclusions

1
2
3
4
5
# BAD — indexes /tmp, /proc, network mounts
sudo updatedb

# GOOD — exclude transient and network paths
sudo updatedb --prunepaths="/tmp /proc /sys /mnt /media /run"

Quick Reference Card

Copy this section and pin it to your terminal:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# =================== FIND ESSENTIALS ===================
find . -name "*.ext" # Find by name
find . -iname "*.ext" # Case-insensitive
find . -type f -size +100M # Large files
find . -mtime -7 -type f # Modified last 7 days
find . -name "*.tmp" -delete # Delete matches
find . -name "*.js" -exec CMD {} + # Execute on matches
find . -print0 | xargs -0 CMD # Safe piping

# =================== LOCATE ESSENTIALS ==================
sudo updatedb # Refresh database
locate -i "filename" # Fast case-insensitive search
locate -c "*.pdf" # Count matches
locate -r '\.conf$' # Regex search

# =================== XARGS ESSENTIALS ===================
find . -print0 | xargs -0 CMD # Null-safe execution
cmd | xargs -I {} echo {} # Placeholder mode
cmd | xargs -P 4 -n 1 CMD # 4 parallel processes
cmd | xargs -p CMD # Prompt before each

Tools Used in This Guide


FAQ

Q1: What is GNU findutils? A: GNU findutils is a package of four command-line utilities — find, locate, updatedb, and xargs — used to search for files and execute batch commands on Unix-like operating systems. It comes pre-installed on virtually every Linux distribution and is available for macOS via Homebrew and Windows via WSL or Git Bash.

Q2: What is the difference between find and locate? A: find searches the filesystem in real-time by traversing directories, making it slower but always up-to-date. locate searches a pre-built database of filenames, making it 10-100x faster but potentially missing recently created files. Use updatedb to refresh the locate database.

Q3: Does macOS have findutils? A: macOS ships with BSD versions of find and xargs, which have slightly different flags than GNU versions. To get full GNU findutils compatibility, install via Homebrew with brew install findutils. The GNU versions are available as gfind, glocate, gupdatedb, and gxargs.

Q4: How do I use find on Windows? A: Windows doesn't include GNU findutils natively. Your best options are: WSL (Windows Subsystem for Linux) which gives you full Linux commands, Git Bash which includes find and xargs, or PowerShell's Get-ChildItem cmdlet which provides similar functionality. For a no-install alternative, findutils.com offers 250+ free browser-based tools for file processing.

Q5: Is findutils.com related to GNU findutils? A: FindUtils is a collection of browser utility pages. It is separate from GNU Findutils, whose programs include find and xargs. Individual web tools can help with tasks found inside shell pipelines.

Q6: How do I handle filenames with spaces in find and xargs? A: Always use the -print0 flag with find and the -0 flag with xargs. This uses null characters instead of newlines as delimiters, safely handling any filename regardless of spaces or special characters: find . -name "*.txt" -print0 | xargs -0 rm.

Q7: What is the fastest way to find files on Linux? A: locate searches a prepared index, while find walks the selected filesystem paths. Index age, filesystem size, and query conditions affect speed. Use find when current filesystem state matters.


Next Steps