↑ ↓ select, Enter open, Esc close

Roughly measure the total size of a page with all assets

Adjust the values, the command updates live
user@server
wget -q -p -H -nd -e robots=off -P /tmp/page-weight https://example.com/; du -sh /tmp/page-weight; ls -lhS /tmp/page-weight | head -15

Fetches the page along with all directly embedded resources (-p), including those from other hosts such as CDNs (-H), and stores everything flat in one directory. Then the total size and the 15 largest files are shown. It measures the uncompressed size, so the result is more of an upper bound.

Note: Files loaded via JavaScript or lazy loading are missing. Delete the target directory before running it again, otherwise the files add up.

Also searched as

  • how heavy is my web page
  • measure page weight command line
  • total size of all files on a page
  • find largest resources of a page

Check Cache-Control of all CSS, JS and image files on a page

$curl -s https://example.com/ | grep -oE '(src|href)="[^"]+\.(css|js|woff2?|jpe?g|png|gif|webp|avif|svg)(\?[^"]*)?"' | cut -d'"' -f2 | sed -E 's#^//#https://#; s#^/#https://example.com/#' | grep '^http' | sort -u | while read -r a; do printf '%-45s %s\n' "$(curl -sI "$a" | grep -i '^cache-control:' | tr -d '\r')" "$a"; done
harmlessImages and performance

Find web font files and their size

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

Find broken links on a website with wget --spider

$LC_ALL=C wget --spider -r -l 2 -nd -nv -w 1 -o /tmp/spider.log https://example.com/; grep -A 100 'broken link' /tmp/spider.log
harmlessSEO checks

Check HTTP/3 support via the Alt-Svc header

$curl -sI https://example.com/ | grep -i '^alt-svc'
harmlessImages and performance

Compare the response time of a PHP page with a static file

$for u in https://example.com/ https://example.com/wp-includes/css/dist/block-library/style.min.css; do curl -o /dev/null -s -w "%{time_starttransfer}s TTFB $u\n" "$u"; done
harmlessImages and performance

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

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.