CURL a list of URLS from a file and get the HTTP response code

Sam Kavanagh

19 Feb 2019

Command

cat list | xargs -i curl -m5 -LI {} -o /dev/null -w '%{http_code} %{url_effective}\n' -s

Example output:

[sam@samantha] λ cat urls | xargs -i curl -m5 -LI {} -o /dev/null -w '%{http_code} %{url_effective}\n' -s
200 https://askjeeves.net/
200 https://www.bbc.com/
404 https://hganavak.github.io/blog/this-doesnt-exist
200 https://unsplash.com/search/photos/kitten
200 https://hganavak.github.io/
[sam@samantha] λ 

Description: