Skip to content

FIND Command Builder - Interactive File Search Tool

What is the FIND Command?

The find command is a powerful Linux utility for searching files and directories based on various criteria including name, type, size, modification date, permissions, and ownership [^43^]. Unlike simple file listing commands, find recursively traverses directory trees and can execute actions on matching files.

Common Use Cases:

  • Locate files by name or pattern across the filesystem
  • Find large files consuming disk space
  • Identify recently modified configuration files
  • Clean up empty files and directories
  • Batch change permissions or ownership
  • Automate file maintenance tasks with -exec

Why Use This FIND Command Builder?

Building find commands requires understanding complex filter combinations and syntax. Our visual builder helps you:

  • ✅ Generate complex commands without syntax errors
  • ✅ Combine multiple filters (name, size, time) intuitively
  • ✅ Copy production-ready commands instantly
  • ✅ Learn advanced find techniques through interactive examples

Core Features

1. Name-Based Search

Find files by their names with flexible matching:

  • Exact match (-name): Case-sensitive filename matching [^43^]
  • Case insensitive (-iname): Ignore case in filename search [^43^]
  • Pattern matching: Use wildcards (*, ?) for partial matches
  • Regex search (-regex): Full regular expression support [^45^]
  • Negation (-not): Find files NOT matching criteria

2. File Type Filtering

Filter by specific file types [^43^][^44^]:

  • Regular files (-type f): Standard files only
  • Directories (-type d): Folder searches only
  • Symbolic links (-type l): Find symlink files
  • Block devices (-type b): Hardware block files
  • Character devices (-type c): Character special files

3. Size-Based Filtering

Locate files by their disk usage [^41^][^47^]:

  • Exact size (-size 100M): Files of specific size
  • Larger than (-size +100M): Files exceeding size [^43^]
  • Smaller than (-size -100M): Files under threshold
  • Size ranges: Combine + and - for ranges [^47^]
  • Empty files (-empty): Find zero-byte files and dirs [^43^]

4. Time-Based Search

Filter by file timestamps [^41^][^47^]:

  • Modification time (-mtime): When file content changed
  • Access time (-atime): When file was last read
  • Change time (-ctime): When metadata changed
  • Minutes variant (-mmin): More granular time control [^47^]
  • Day ranges: Use +N (older than) and -N (newer than)

5. Permission and Ownership

Search by security attributes [^43^][^46^]:

  • By permissions (-perm): Find files with exact permissions
  • By user (-user): Files owned by specific user
  • By group (-group): Files belonging to group
  • SUID/SGID (-perm /u=s): Find special permission files [^46^]
  • Read-only (-perm /u=r): Find non-writable files

6. Execute Actions

Perform operations on found files [^43^][^44^]:

  • -exec: Execute command on each file
  • -ok: Interactive execution with confirmation
  • -delete: Remove found files directly
  • -print: Display matching file paths
  • -ls: Detailed listing of found files

Common FIND Command Patterns

Basic File Discovery

# Find by exact name
find /home -name "document.txt"
 
# Find with wildcards
find . -name "*.log"
 
# Case insensitive search
find /etc -iname "config*"
 
# Find directories only
find /var -type d -name "www"
 
# Find files only
find . -type f -name "*.php"

Size-Based Cleanup

# Find files larger than 100MB
find / -type f -size +100M
 
# Find files between 50MB and 100MB
find /var -size +50M -size -100M
 
# Find empty files
find /tmp -type f -empty
 
# Find empty directories
find /tmp -type d -empty
 
# Find large log files
find /var/log -type f -size +1G -name "*.log"

Time-Based Search

# Files modified in last 7 days
find . -type f -mtime -7
 
# Files accessed in last 24 hours
find . -atime -1
 
# Files modified more than 30 days ago
find /tmp -mtime +30
 
# Files changed between 3-5 days ago
find . -mtime +2 -mtime -6
 
# Find recent config changes
find /etc -name "*.conf" -mtime -1

Find and Execute

# Find and delete .tmp files
find /tmp -name "*.tmp" -type f -delete
 
# Find and delete with confirmation
find . -name "*.bak" -ok rm {} \;
 
# Find and change permissions
find . -type f -perm 644 -exec chmod 664 {} \;
 
# Find and move large files
find . -size +500M -exec mv {} /backup \;
 
# Count lines in found files
find . -name "*.py" -exec wc -l {} \;

Permission and Security

# Find SUID files (security audit)
find / -perm /u=s -type f
 
# Find world-writable files
find / -perm -002 -type f
 
# Find files owned by specific user
find /home -user john
 
# Find SGID files
find / -perm /g=s
 
# Find and fix 777 permissions
find /var/www -type f -perm 0777 -exec chmod 644 {} \;

Advanced Filtering

# Multiple name patterns (OR)
find /etc -name "*.conf" -o -name "*.cfg"
 
# Exclude directories from search
find . -path ./node_modules -prune -o -name "*.js" -print
 
# Find and grep content
find . -type f -name "*.txt" -exec grep "pattern" {} \;
 
# Limit search depth
find . -maxdepth 2 -name "*.config"
 
# Find hidden files
find /home -type f -name ".*"

FIND Command Options Reference

File Name Options

Option Description
-name "pattern" Case-sensitive name match [^43^]
-iname "pattern" Case-insensitive name match [^43^]
-regex "pattern" Full path regex match [^45^]
-not -name Negate name condition
-path "pattern" Match full path pattern

File Type Options

Option Description
-type f Regular files [^43^]
-type d Directories [^43^]
-type l Symbolic links [^45^]
-type b Block devices
-type c Character devices
-type s Sockets

Size Options

Option Description
-size N Exact size (use c, k, M, G) [^41^]
-size +N Larger than N [^43^]
-size -N Smaller than N [^47^]
-empty Zero-byte files/dirs [^43^]

Time Options

Option Description
-mtime N Modified N days ago [^41^]
-atime N Accessed N days ago
-ctime N Changed N days ago [^47^]
-mmin N Modified N minutes ago [^47^]
-amin N Accessed N minutes ago
-newer file Newer than reference file

Permission Options

Option Description
-perm 644 Exact permission match [^43^]
-perm /u=s SUID files [^46^]
-perm /g=s SGID files
-user name Owned by user [^43^]
-group name Owned by group

Action Options

Option Description
-exec cmd {} ; Execute command [^43^]
-ok cmd {} ; Confirm before execute
-delete Delete found files [^44^]
-print Print path (default)
-ls Detailed listing

Search Control

Option Description
-maxdepth N Limit directory depth [^43^]
-mindepth N Minimum directory depth
-prune Exclude subdirectory
-follow Follow symbolic links
-mount Don't cross filesystems

Size and Time Modifiers

Size Suffixes

Suffix Unit
c Bytes
k Kilobytes (1024 bytes)
M Megabytes
G Gigabytes
b 512-byte blocks (default)

Time Modifiers

Modifier Meaning
+N More than N days ago
-N Less than N days ago
N Exactly N days ago

FAQ

What's the difference between -mtime and -ctime?

-mtime checks when the file content was last modified [^41^]. -ctime checks when the file's metadata (permissions, ownership) was changed [^47^]. Use -mtime for content changes, -ctime for permission tracking.

How do I find and delete files safely?

Use -ok instead of -exec for interactive confirmation: find . -name "*.tmp" -ok rm {} \; [^43^]. For automated deletion, use -delete flag or ensure your pattern is correct before executing.

Why does find show "Permission denied" errors?

The find command attempts to traverse all directories. When it encounters directories without read permissions, it outputs permission denied. Redirect stderr to hide these: find / 2>/dev/null or run with sudo for system-wide searches.

How do I search multiple directories?

Specify multiple paths at the beginning: find /var/log /tmp /home -name "*.log" searches all three directories simultaneously.

Can I limit how deep find searches?

Yes, use -maxdepth to limit recursion depth [^43^]. find . -maxdepth 2 -name "*.txt" searches only current directory and one level deep, ignoring deeper subdirectories.

How do I find files by content?

While find locates files by attributes, combine it with grep for content: find . -type f -name "*.txt" -exec grep "search-term" {} + [^43^]. This searches all .txt files for the specified content.

What's the difference between -exec and -exec {} +?

-exec ... \; runs the command once per file. -exec ... + passes multiple files to a single command execution, which is more efficient for commands that accept multiple arguments (like rm, chmod).

How do I exclude directories from search?

Use -prune to skip directories: find . -path ./node_modules -prune -o -name "*.js" -print excludes node_modules while searching for .js files [^43^].


Technical Specifications

  • Zero dependencies: Runs entirely in browser
  • No backend required: Static hosting compatible
  • Offline capable: Works without internet after initial load
  • Privacy focused: No data leaves your browser
  • Keyboard shortcuts: Full keyboard navigation support

Related Tools

  • grep Content Search
  • locate Database Search
  • whereis Binary Finder
  • which Command Locator
  • ls File Listing
  • chmod Permission Calculator

Resources


Last Updated: 2025 License: Free to use Platform: Web-based, works on all modern browsers