#find
34 Einzeiler mit diesem Stichwort.
Alle Einzeiler mit Tag find
Alle Dateien mit bestimmtem Namen rekursiv löschen
$find /var/www/vhosts/example.com/httpdocs -type f -name 'error_log' -print -delete
Datei nach Namen suchen
$find /var/www/vhosts -iname '*wp-config*' 2>/dev/null
Alle Dateien rekursiv auf 644 setzen
$find /var/www/vhosts/example.com/httpdocs -type f -exec chmod 644 {} +
Alle hinterlegten SSH-Schlüssel auf dem Server auflisten
#find / -xdev -path '*/.ssh/authorized_keys' -type f -exec awk 'NF && !/^#/ {print FILENAME ": " $NF}' {} + 2>/dev/null
Alle symbolischen Links mit Ziel auflisten
$find /var/www/vhosts/example.com -type l -printf '%p -> %l\n'
Alle Verzeichnisse rekursiv auf 755 setzen
$find /var/www/vhosts/example.com/httpdocs -type d -exec chmod 755 {} +
Besitzer im Plesk-Webspace auf Abo-Benutzer zurücksetzen
#find /var/www/vhosts/example.com/httpdocs -mindepth 1 -exec chown -h webuser:psacln {} +
Bilder rekursiv nach AVIF umwandeln
$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -exec sh -c 'for f; do [ -e "$f.avif" ] || avifenc -s 6 "$f" "$f.avif" >/dev/null; done' sh {} +
Bilder rekursiv nach WebP umwandeln
$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -exec sh -c 'for f; do [ -e "$f.webp" ] || cwebp -quiet -q 80 "$f" -o "$f.webp"; done' sh {} +
CSS-, JS- und SVG-Dateien mit gzip und Brotli vorkomprimieren
$find /var/www/vhosts/example.com/httpdocs/wp-content/themes -type f \( -name '*.css' -o -name '*.js' -o -name '*.svg' \) -exec gzip -k -9 -f {} + -exec brotli -k -f {} +
Dateien älter als X Tage löschen
$find /var/backups/example.com -type f -name '*.tar.gz' -mtime +30 -print -delete
Dateien finden, die älter als X Tage sind
$find /var/www/vhosts/example.com -type f -mtime +30 -printf '%TY-%Tm-%Td %p\n' | sort | head -100
Dateien finden, die in einem Zeitraum geändert wurden
$find /var/www/vhosts/example.com/httpdocs -type f -newermt '2026-10-01' ! -newermt '2026-10-08' -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort
Dateien mit fremdem Besitzer im Webspace finden
#find /var/www/vhosts/example.com/httpdocs ! -user webuser -ls
Dateien mit SUID- oder SGID-Bit finden
#find / -xdev \( -perm -4000 -o -perm -2000 \) -type f -exec ls -l {} + 2>/dev/null
Dateien ohne gültigen Besitzer finden
#find /var/www -xdev \( -nouser -o -nogroup \) -ls 2>/dev/null
Defekte symbolische Links finden
$find /var/www/vhosts/example.com -xtype l -ls
Doppelte Dateien anhand der Prüfsumme finden
$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f -size +0 -exec md5sum {} + | sort | uniq -w32 --all-repeated=separate
Für alle beschreibbare Dateien und Ordner finden
$find /var/www/vhosts -xdev -perm -0002 ! -type l -ls 2>/dev/null
Für alle beschreibbare Dateien und Verzeichnisse finden
$find /var/www/vhosts -xdev -perm -0002 ! -type l -ls 2>/dev/null
Gesamtgröße aller Dateien eines Typs berechnen
$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f -iname '*.mp4' -printf '%s\n' | awk '{s+=$1; n++} END {printf "%d Dateien, %.1f MB\n", n, s/1048576}'
Große Bilder in wp-content/uploads finden
$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.gif' -o -iname '*.webp' \) -size +500k -printf '%s\t%p\n' | sort -rn | head -50 | numfmt --field=1 --to=iec
Größte Dateien in einem Verzeichnis finden
$find /var/www/vhosts -type f -size +500M -exec ls -lh {} + 2>/dev/null | sort -k5 -rh | head -20
In den letzten Minuten geänderte Dateien finden
$find /var/www/vhosts/example.com/httpdocs -type f -mmin -60 -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r
JPEG-Bilder verlustfrei mit jpegoptim optimieren
$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f \( -iname '*.jpg' -o -iname '*.jpeg' \) -exec jpegoptim --strip-all --preserve {} +
Kürzlich geänderte PHP-Dateien finden
$find /var/www/vhosts/example.com/httpdocs -type f -name '*.php' -mtime -7 -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r
Leere Verzeichnisse finden
$find /var/www/vhosts/example.com/httpdocs -mindepth 1 -type d -empty
Leere Verzeichnisse rekursiv löschen
$find /var/www/vhosts/example.com/httpdocs -mindepth 1 -type d -empty -print -delete
Nicht minifizierte CSS- und JS-Dateien finden
$find /var/www/vhosts/example.com/httpdocs/wp-content -type f \( -name '*.css' -o -name '*.js' \) ! -name '*.min.*' -size +20k -exec sh -c 'echo "$(wc -l < "$1") $1"' sh {} \; | awk -v n=200 '$1 > n' | sort -rn | head -30
PHP-Dateien im WordPress-Uploads-Ordner aufspüren
$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f \( -iname '*.php' -o -iname '*.phtml' -o -iname '*.php[0-9]' \) -ls
PNG-Bilder verlustfrei mit optipng optimieren
$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f -iname '*.png' -exec optipng -o2 -strip all -preserve {} +
Versteckte PHP-Dateien im Webverzeichnis finden
$find /var/www/vhosts/example.com/httpdocs -type f -name '.*.php' -ls
Webfont-Dateien und ihre Größe finden
$find /var/www/vhosts/example.com/httpdocs/wp-content -type f \( -iname '*.woff2' -o -iname '*.woff' -o -iname '*.ttf' -o -iname '*.otf' -o -iname '*.eot' \) -printf '%s\t%p\n' | sort -rn | head -30 | numfmt --field=1 --to=iec
Zeilen in vielen Dateien zählen und sortieren
$find /var/www/vhosts/example.com/httpdocs/wp-content/themes -type f -name '*.php' -exec wc -l {} + | sort -rn | head -n 20