find – recursively walk a file hierarchy
SYNOPSIS
find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
- find all files under current directory
find .
- specify a directory, e.g. the user home directory
find ~
- find only directories
find . -type d
- or find only files
find . -type f
- find all txt files
find . -type f -name "*.txt"
- use
-iname
to ignore name sensitivefind . -type f -iname "*.txt"
- find all files modified in last 10 minutes ( less than )
find . -type f -mmin -10
- Combine! find all files modified more than 1 minute, but less than 5 minutes
find . -type f -mmin +1 -mmin -5
- replace
mmin
withmtime
if you want useday
instead ofminute
.
- find all files which file size is over 5M
find . -type f -size +5M
find . -perm 755
- find all markdown files in only current directory
find . -type f -name "*.md" -maxdepth 1