↑ ↓ select, Enter open, Esc close

#curl

43 one-liners with this tag.

All one-liners tagged curl

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

Check for soft 404s: does a missing page really return 404

$curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' https://example.com/diese-seite-gibt-es-nicht-$RANDOM
harmlessSEO checks

Check HTTP status codes for a list of URLs

$while read -r u; do printf '%s %s\n' "$(curl -o /dev/null -sS -w '%{http_code}' "$u")" "$u"; done < urls.txt
harmlessNetwork

Check HTTP/3 support via the Alt-Svc header

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

Check if LiteSpeed Cache serves a page from cache

$curl -s -o /dev/null -D - https://example.com/ | grep -iE "^(server|x-litespeed-cache[a-z-]*):"
harmlessLiteSpeed

Check maintenance mode for status 503 and Retry-After

$curl -s -o /dev/null -D - https://example.com/ | grep -iE '^(HTTP/|retry-after:)'
harmlessSEO checks

Check the browser caching headers of a file

$curl -sI https://example.com/wp-includes/css/dist/block-library/style.min.css | grep -iE "^(cache-control|expires|etag|last-modified|age):"
harmlessnginx

Check the status code of all sitemap.xml URLs in parallel

$curl -s https://example.com/sitemap.xml | grep -oP '(?<=<loc>)[^<]+' | xargs -P 8 -I{} curl -o /dev/null -s -w '%{http_code} %{url_effective}\n' {} | grep -v '^200 ' | sort
harmlessSEO checks

Check the X-Robots-Tag header of a URL

$curl -s -o /dev/null -D - https://example.com/ | grep -i '^x-robots-tag'
harmlessSEO checks

Check whether a website sends the HSTS header

$curl -sI https://example.com/ | grep -i "^strict-transport-security"
harmlessSSL and certificates

Check whether a website serves gzip or Brotli

$curl -s -o /dev/null -D - -H "Accept-Encoding: br, gzip" https://example.com/ | grep -i "^content-encoding"
harmlessnginx

Check whether a website supports HTTP/2

$curl -sI --http2 https://example.com/ | head -1
harmlessnginx

Check whether the server returns 304 Not Modified

$curl -s -o /dev/null -w '%{http_code}\n' -H "If-Modified-Since: $(curl -sI https://example.com/ | grep -i '^last-modified:' | cut -d' ' -f2- | tr -d '\r')" https://example.com/
harmlessSEO checks

Collect all URLs from a sitemap index

$curl -s https://example.com/sitemap_index.xml | grep -oP '(?<=<loc>)[^<]+' | xargs -n1 curl -s | grep -oP '(?<=<loc>)[^<]+' | sort -u
harmlessSEO checks

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

Detect the web server and PHP version from HTTP headers

$curl -sI https://example.com/ | grep -iE "^(server|x-powered-by|via):"
harmlessnginx

Extract all URLs from a sitemap.xml

$curl -s https://example.com/sitemap.xml | grep -oP '(?<=<loc>)[^<]+' | sort -u
harmlessSEO checks

Extract and count the internal links of a page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE 'href="[^"]+"' | sed -E 's/^href="//I; s/"$//; s/#.*//' | grep -E '^(/|https?://(www\.)?example.com)' | sort | uniq -c | sort -rn
harmlessSEO checks

Extract the H1 headings of a page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiP '<h1[^>]*>.*?</h1>' | sed -E 's/<[^>]+>//g; s/^\s+|\s+$//g'
harmlessSEO checks

Extract the structured data (JSON-LD) of a page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oP '<script[^>]*application/ld\+json[^>]*>.*?</script>'
harmlessSEO checks

Fetch a page as Googlebot and compare with a normal request

$for ua in 'Mozilla/5.0 (X11; Linux x86_64)' 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'; do curl -s -o /dev/null -A "$ua" -w "%{http_code} %{size_download} Bytes $ua\n" https://example.com/; done
harmlessSEO checks

Fetch robots.txt and show the Disallow rules

$curl -s https://example.com/robots.txt | grep -iE '^\s*(user-agent|disallow|allow|sitemap):'
harmlessSEO checks

Fetch the Apache server-status in compact form

$curl -s "http://localhost/server-status?auto"
harmlessApache

Find images without a loading attribute on a page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<img[^>]*>' | grep -vi 'loading='
harmlessImages and performance

Find images without an alt attribute on a page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<img[^>]*>' | grep -viE '\balt='
harmlessSEO checks

Find meta robots and noindex in the HTML of a page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<meta[^>]*name=.?(robots|googlebot)[^>]*>'
harmlessSEO checks

Find mixed content in the HTML of an HTTPS page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '(src|srcset|data-src)="http://[^"]+"|<link[^>]+href="http://[^"]+"|url\(.?http://[^)]+\)' | sort -u
harmlessSEO checks

Find scripts without async or defer on a page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<script[^>]*src=[^>]*>' | grep -viE 'async|defer|type=.?module'
harmlessImages and performance

Find the public IP address of a server

$curl -4 -s https://icanhazip.com
harmlessNetwork

Follow and show the redirect chain of a URL

$curl -sSIL http://example.com/ | grep -iE '^(HTTP/|location:)'
harmlessNetwork

Get the latest WordPress version from the API

$curl -s https://api.wordpress.org/core/version-check/1.7/ | jq -r '.offers[0].version'
harmlessText processing

Measure gzip and Brotli savings for a URL

$for e in identity gzip br; do curl -s -o /dev/null -H "Accept-Encoding: $e" -w "$e: %{size_download} Bytes\n" https://example.com/; done
harmlessImages and performance

Measure HTTP load times and TTFB with curl

$curl -o /dev/null -sS -w 'DNS: %{time_namelookup}s Connect: %{time_connect}s TLS: %{time_appconnect}s TTFB: %{time_starttransfer}s Gesamt: %{time_total}s\n' https://example.com/
harmlessNetwork

Measure the HTML and header size of a page

$curl -s -o /dev/null -w 'Status: %{http_code} Header: %{size_header} Bytes HTML: %{size_download} Bytes\n' https://example.com/
harmlessSEO checks

Measure TTFB repeatedly with minimum, median and maximum

$for i in $(seq 10); do curl -o /dev/null -s -w '%{time_starttransfer}\n' https://example.com/; done | LC_ALL=C sort -n | awk '{a[NR]=$1; s+=$1} END {printf "Min: %.3fs Median: %.3fs Max: %.3fs Schnitt: %.3fs\n", a[1], a[int((NR+1)/2)], a[NR], s/NR}'
harmlessSEO checks

Read the canonical tag of a page with curl

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<link[^>]*canonical[^>]*>'
harmlessSEO checks

Read the hreflang tags of a page

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<link[^>]*hreflang[^>]*>'
harmlessSEO checks

Read the title and meta description of a page with curl

$curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<title[^>]*>[^<]*</title>|<meta[^>]*name=.?description[^>]*>'
harmlessSEO checks

Show the HTTP response headers of a website

$curl -sSI https://example.com/
harmlessNetwork

Show the number of redirects and the final URL

$curl -sL -o /dev/null -w 'Weiterleitungen: %{num_redirects}\nZiel: %{url_effective}\nStatus: %{http_code}\n' https://example.com/
harmlessSEO checks

Show the redirect chain of a URL with status codes

$curl -sIL "http://example.com/" | grep -iE "^(HTTP/|location:)"
harmlessApache

Test a website on a new server before the DNS change

$curl -sSI --resolve example.com:443:203.0.113.10 https://example.com/
harmlessNetwork

Test http, https, www and non-www at once

$for u in http://example.com/ http://www.example.com/ https://example.com/ https://www.example.com/; do curl -s -o /dev/null -m 10 -w "%{http_code} $u -> %{redirect_url}\n" "$u"; done
harmlessSEO checks

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.