find
command in bashfind
command in bashFind all files below the current directory that match “filename.txt”
find . -name filename.txt
Find all files below the current directory that start with “filena”
find . -name "filena*"
Find files with a name, ignoring case
find . -iname "FileName.txt"
Find directories in “/” with name “Dirname”
find / -type d -name Dirname
Find all files of type “txt”
find . -type f -name "*.txt"
Exclude directories
find . -not \( -path ./miniconda3 -prune \) -name \*.py -print
find . -type f -name "*.md" -print0 | xargs -0 sed -i 's/foo/bar/g'
Find links in markdown files ending in .mp4
find . -iname "*.md" -exec grep -l '.mp4)' {} \+
Find “video_source” keys in yaml files ending in .yaml
find . -iname "*.yaml" -exec grep -l 'video_source:' {} \+
excluding multiple directories
find . -not \( -path ./repos -prune -o -path ./zenbook-backup -prune -o -path "./.local" -prune -o -path ./.gradle -prune -o -path ./envs -prune -o -path ./.vscode -prune -o -path ./.config -prune \) -name "*code*" -type d
find . -iname "*.docx" -maxdepth 2
find . -iname "*50_Lines_of*" 2> >(grep -v 'Permission denied' >&2)
or simpler:
find . -iname "*50_lines_of*" 2>&1 | grep -v "Permission denied"
or just use sudo
sudo find . -iname "*50_lines_of*"
find . -type d ! -user danaukes
find . -maxdepth 4 \( -iname "*.py" -o -iname "*.ipynb" \) -exec grep -in cadquery {} \+
find . -name '.gitignore' | xargs wc -l