Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've learned that we can send multiple HTTP requests with CURL by doing this:

curl -I

or this:

xargs curl -I < url-list.txt

How can we save the all responses we get - every one of them to a different file?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You can use the -o command line option to write the output to a file instead of stdout. You can use multiple -os e.g.

curl -I -o lne.txt

If you format you urls-list.txt like so -o -o

it should work as you want.

share|improve this answer
$ cat urls-list.txt

$ while read u; do \
    curl -I $u -o $(echo $u | sed 's/http:\/\///' | tr '/' '_').header; \
done < urls-list.txt

$ cat 
HTTP/1.1 200 OK
Date: Thu, 24 Nov 2011 03:15:19 GMT
Server: LiteSpeed
Connection: close
X-Powered-By: PHP/5.2.10
Content-Type: text/html
X-Powered-By: PleskLin
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.