Bash
find
find command for searching files and directories.
30 commands
Windows
MacOS
Linux
#file-search
#system
Basic Search
Find files by name pattern
find . -name "*.txt"
Search the entire filesystem
find / -name "config.yml"
Case-insensitive name search
find . -iname "readme*"
Match against the full path
find . -path "*/src/*.js"
Find files not matching a pattern
find . -not -name "*.log"
By Type & Size
Find regular files only
find . -type f
Find directories only
find . -type d
Find symbolic links only
find . -type l
Find files larger than 100 MB
find . -size +100M
Find files smaller than 1 KB
find . -size -1k
Find empty files and directories
find . -empty
By Time
Files modified in the last 7 days
find . -mtime -7
Files modified more than 30 days ago
find . -mtime +30
Files modified in the last 60 minutes
find . -mmin -60
Files newer than a reference file
find . -newer reference.txt
Files accessed in the last 24 hours
find . -atime -1
By Permission
Find files with exact permissions 644
find . -perm 644
Find files with at least 755 permissions
find . -perm -755
Find files owned by root
find . -user root
Find files belonging to a group
find . -group staff
Find files executable by owner
find . -perm /u+x
Execute Actions
Delete all matching files
find . -name "*.tmp" -delete
Make scripts executable
find . -name "*.sh" -exec chmod +x {} \;
Remove files efficiently in batch
find . -name "*.log" -exec rm {} +
Find files containing a string
find . -type f -exec grep -l "TODO" {} +
Move matching files
find . -name "*.jpg" -exec mv {} ./images/ \;
List largest files
find . -type f -printf "%s %p\n" | sort -rn | head
Quick Commands
Find all .txt files in current directory tree
find . -name "*.txt"
Find files larger than 100 megabytes
find . -type f -size +100M
Find files modified in the last 7 days
find . -mtime -7