Script – Check urls

chmod +x urlcheck.sh


Script name: urlcheck.sh

author: "mkw" - marcia wilbur

license: GPL v3

Date posted to Linuxdocs.io: September 27, 2021

Purpose: check urls in md or text files


Must understand the following codes for output:

  • 200 OK
  • 301 Moved permanently (often redirect)
  • 302 Found / Moved temporarily
  • 404 Not Found
  • 410 Gone
  • 503 Service Unavailable


#!/bin/#!/bin/bash
# author: mkw
# date: sept 2021 released to linuxdocs.io
# license: gplv3 - see https://www.gnu.org/licenses/gpl-3.0.en.html
# output: https codes in file (example httpsstat.md)

while read url
do
    httpsstat=$(curl -o /dev/null --silent --head --write-out '%{http_code}' "$url" )
    echo "$url  $httpsstat" >> httpsstat.md
done < $1