User Tools

Site Tools


linux:find

Windows - Remove thumbs.db

Find all files named “thumbs.db” in current directory and delete them.

find . -iname "thumbs.db" -delete

MacOS - Remove .DS_Store

Find all files named “.DS_Store” in current directory and delete them.

find . -iname "*.DS_Store" -delete

Set default access rights for directories and files

find . -type f -name '*' -exec chmod 660 {} \;
find . -type d -name '*' -exec chmod 770 {} \;

Count files

find . -type f | wc -l

Find text

find / -type f -exec grep -H 'text-to-find-here' {} \;

Find files bigger than 1GB

find . -size +1G

Replace text in all files

find ./ -type f -exec sed -i 's/string1/string2/g' {} \;

Find files modified today

find . -mtime -1 -print

Remove all files 14days old

find . -mtime +14 -exec rm {} \;
linux/find.txt · Last modified: 2021/01/21 17:00 by Jan Forman