← Cheat Sheets

find Command Examples

Search the file system by name, type, size and time.

# find Command Examples

Search the file system by name, type, size and time.

```bash
find . -name "*.txt"            # by name
find . -iname "*.jpg"            # case-insensitive
find . -type f                   # files only (d = directories)
find . -maxdepth 2 -type d
find . -mtime -7                 # modified in the last 7 days
find . -size +10M                # larger than 10 MB
find . -empty                    # empty files and folders
find . -name "*.log" -delete
find . -name "*.js" -exec grep -l "TODO" {} \;
```