↑ ↓ select, Enter open, Esc close

Check HTTP status codes for a list of URLs

Adjust the values, the command updates live
user@server
while read -r u; do printf '%s %s\n' "$(curl -o /dev/null -sS -w '%{http_code}' "$u")" "$u"; done < urls.txt

Reads the file line by line and fetches each URL with curl. It prints the status code and URL, so the list can be filtered further with sort or grep -v '^200'. Useful after a relaunch for checking old URLs for correct redirects and missing pages.

Note: Redirects are not followed, so a 301 is the desired result for old URLs. With -L in the curl call, the status of the target page appears instead.

Also searched as

  • check status codes of multiple urls
  • bulk check redirects after relaunch
  • find 404 pages from url list

Related one-liners

All in Network

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.