Differences

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

Link to this comparison view

Next revision
Previous revision
find [2020/03/29 17:14] – created 192.168.1.48find [2024/12/30 12:03] (current) – [All files modified today] admin
Line 8: Line 8:
 <code> <code>
 find -name '*filename*' -exec rename -v ' ' _ {} \; find -name '*filename*' -exec rename -v ' ' _ {} \;
 +</code>
 +
 +===== All files modified today =====
 +<code>
 +find / -path /proc -prune -o -path /sys -prune -o -type f -newermt "$(date +%Y-%m-%d)" -ls|more
 +find / -mount -mtime -1 -ls |sort -k 11 |less
 +</code>
 +
 +===== FILES NOT OWNED BY APACHE FORMATTED =====
 +<code>
 +# find data/ \! -user apache -printf "%u \t %g \t %t \t %s \t %h%p \n"
 +</code>
 +
 +===== MULITPLE FILENAMES =====
 +<code>
 +# find . \( -iname \*40785\* -o -iname \*40791\* -o -iname \*40806\* \) -exec ls -l {} \;
 +</code>
 +
 +===== SPECIFIC PERMS =====
 +<code>
 +# find . -type d -perm +g=x \! -perm +g=w \! -user apache -exec chmod g+w {} \;
 +# find . -group pr -type f \! -perm +u=w -exec chmod u+w {} \;
 +# find . \! -perm +a=r -exec ls -ld {} \; 
 +# find apps/ -type d -exec ls -ld {} \; | less
 +</code>
 +
 +===== FIND AND CORRECT PERMS =====
 +<code>
 +# find apps/ -type d -exec chmod g+w {} \;
 +# find apps/ -type d -exec chmod g-s {} \;
 +</code>
 +
 +===== WITH EXCLUDED PATHS =====
 +<code>
 +# find . -path './data' -prune -o -path './logs' -prune -o -type f -exec grep -iHn "ecu.edu.au" {} \; |less
 +</code>
 +
 +===== WITH EXCLUDED FILES FORMATTED =====
 +<code>
 +# find cache/ ! \( -name "sess_*" \) -ctime 1 -printf "\t%s \t %a \t %h%p \n"
 +# find cache/ ! \( -name "sess_*" \) -mmin 700 -printf "%t \t %s \t %h%p \n" 2>/dev/null
 +</code>
 +
 +===== SIZE OF FOLDERS/FILES IN A SINGLE FOLDER =====
 +<code>
 +# find /var/log/ -maxdepth 1 -exec du -s {} \; |sort -n
 +</code>
 +
 +===== FILES CHANGED IN THE LAST 24 HOURS AND PRINT FORMATTED =====
 +<code>
 +# find . -type f -ctime 1 -printf "\t%s \t %a \t %h%p \n"
 +</code>
 +
 +===== FILES WITH GROUP STICKY BIT SET =====
 +<code>
 +# find . -perm 2775 -printf "%m %g" -exec ls -d {} \;
 +# find . -maxdepth 2 -perm -2000 -type d -printf "%m \t %u \t %g \t" -exec ls -d {} \;
 +</code>
 +
 +===== FIX DIRECTORIES WITH STICKY BIT SET =====
 +<code>
 +# find . -type d -exec chmod g-s {} \;
 </code> </code>
  
  • find.1585473281.txt.gz
  • Last modified: 2020/03/29 17:14
  • by 192.168.1.48