Insight in Plain Sight

The Bash find Command

Basic Usage

find "path" -name "*jpg"

Filter for Files or Directories

# Find only files
find -name "*jpg" -type f
# Find only directories
find -name "*jpg" -type d

Ignore Case

find -iname "*jpg"

Combine Conditions

find -name "2021*" -name "*jpg"

By Size

# Files bigger than 10 Kilobytes
find -size +10K
# Files bigger than 10 Megabytes
find -size +10M
# Files bigger than 10 Gigabytes
find -size +10G
# Files smaller than 10 Gigabytes
find -size -10G

By Time

# Files modified less than 10 minutes ago
find -mmin -10
# Files modified more than 10 minutes ago
find -mmin +10
# Files modified more exactly 10 minutes ago
find -mmin 10

# Same rules with mtime for days
find -mtime -10

Footnote

Props to prism.js for the pretty code formatting