↑ ↓ select, Enter open, Esc close

Find web font files and their size

Adjust the values, the command updates live
user@server
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

Shows the 30 largest font files with size and path. Web fonts often block text rendering and shift the layout, which hurts LCP and CLS. Outdated formats such as TTF or EOT and full character sets without subsetting stand out quickly here.

Note: WOFF2 is enough for modern browsers. The page source or the theme’s CSS shows whether a file is actually loaded.

Also searched as

  • find large font files
  • which web fonts are in my theme
  • fonts slowing down website
  • check locally hosted google fonts

Convert images to AVIF recursively

$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 {} +
cautionImages and performance

Convert images to WebP recursively

$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 {} +
cautionImages and performance

Find large images in wp-content/uploads

$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
harmlessImages and performance

Find unminified CSS and JS files

$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
harmlessImages and performance

Optimize JPEG images losslessly with jpegoptim

$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f \( -iname '*.jpg' -o -iname '*.jpeg' \) -exec jpegoptim --strip-all --preserve {} +
cautionImages and performance

Optimize PNG images losslessly with optipng

$find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f -iname '*.png' -exec optipng -o2 -strip all -preserve {} +
cautionImages and performance

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.