User Tools

Site Tools


linux:find
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


linux:find [2021/01/21 17:00] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== Windows - Remove thumbs.db ======
 +Find all files named "thumbs.db" in current directory and delete them.
  
 +<code>find . -iname "thumbs.db" -delete</code>
 +
 +====== MacOS - Remove .DS_Store ======
 +Find all files named ".DS_Store" in current directory and delete them.
 +
 +<code>find . -iname "*.DS_Store" -delete</code>
 +
 +====== Set default access rights for directories and files ======
 +<code>
 +find . -type f -name '*' -exec chmod 660 {} \;
 +find . -type d -name '*' -exec chmod 770 {} \;
 +</code>
 +
 +====== Count files ======
 +<code>find . -type f | wc -l</code>
 +
 +====== Find text ======
 +<code>find / -type f -exec grep -H 'text-to-find-here' {} \;</code>
 +
 +====== Find files bigger than 1GB ======
 +<code>find . -size +1G</code>
 +
 +====== Replace text in all files ======
 +<code>find ./ -type f -exec sed -i 's/string1/string2/g' {} \;</code>
 +
 +====== Find files modified today ======
 +<code>find . -mtime -1 -print</code>
 +
 +====== Remove all files 14days old ======
 +<code>find . -mtime +14 -exec rm {} \;</code>
linux/find.txt · Last modified: 2021/01/21 17:00 by Jan Forman