Find by name
find . -iname "{pattern}" -o -iname "{pattern}"
Find by regex
find . -iregex "\..*\.mp3"
Delete files more than {n} days old
find . -iname "{pattern}" -type f -mtime +{n} -delete
Archieve and delete files
find . -iname "{pattern}" -type f -print | xargs tar -czvPf ./{file}.tar.gz --remove-files
Archieve and delete files more than {n} days old
find . -iname "{pattern}" -type f -mtime +{n} -print | xargs tar -czvPf ./{file}.tar.gz --remove-files
Change new lines from DOS to UNIX
find ./ -type f -exec dos2unix {} \;
Find and count
find . -type f -name "*.pdf" | wc -l
Find and delete
find . -type f -name "*.json" -exec rm -f {} \;
Run a command with each found file
find . -exec sh -c 'commands "$1"' sh {} \;
Find files bigger than
find / -size +10M -size -12M -ls
Prevent the ./ at the beginning of each filen ame
find * -maxdepth 0
Append 2>/dev/null at the end of the command to avoid the permission denied message
Execute git status in all the directories in the current directory.
find * -maxdepth 0 -type d -exec echo "-----> {}" \; -exec git -C {} status \;
linux command