find
Linux · Files · available in the simulator
What it does
Searches for files in a directory hierarchy based on various criteria. Supports logical operators with -a (and), -o (or), and ! (not).
Syntax
find [ruta...] [expresión]
Options and parameters
-nameSearches by file name (case-sensitive).
find . -name "*.log"-inameSearches by file name (case-insensitive).
-path/-ipathmatches against full path
-sizeFilters by size; +10M matches files greater than 10 megabytes.
find . -size +10M-typeFilters by type: f for regular file, d for directory, l for symbolic link.
find /etc -type f-user/-groupfilters by owner/group
-amin/-mmin/-cminaccessed/modified/changed in minutes
-atime/-mtime/-ctimeaccessed/modified/changed in days
-exec ... {} \;executes a command for each file
-exec ... {} +executes the command with all files combined
-mtimeFilters by days since last modification.
find . -mtime -7-mminFilters by minutes since last modification.
-userFilters by file owner.
-permFilters by file permissions.
-maxdepthLimits the directory depth searched.
find . -maxdepth 1 -type d-deleteDeletes found files.
-execExecutes a command for each matched file; terminated by \;.
find . -name "*.tmp" -exec rm {} \;-print0Separates results with a null character; useful with xargs -0.
Usage examples
find /dev -amin -30find /home/smr1 -size +10Mfind /etc -size +100k -a -size -1Mfind /home/smr1 -name "*documento*.docx"find /home/smr1 -ipath "*Linux*"find /boot -user rootfind /home/smr1/sistemas -type ffind /home/smr1 -type f -size +0 -exec du -h {} \;find /home/smr1 -type f -size +0 -exec du -h {} +find . -name '*.log'find /tmp -type f -mtime +7 -deletefind . -name "*.log"find /etc -type ffind . -size +10Mfind . -mtime -7find . -maxdepth 1 -type dfind . -name "*.tmp" -exec rm {} \;