cURL output to file cURL output to file curl curl

cURL output to file


This output is sent to stderr. So, to get it all you need is redirect stream 2 (stderr) to a file as

curl -o responseFile.html http://www.somewhere.com 2> informationFile.txt

But, as your capture shows, times are not always included.

The better option to know if the request succeded and how long it took is to ask curl to output some internal variables. This is done with the -w switch. So, your command should look as

curl -o responseFile.html http://www.somewhere.com -w "%{response_code};%{time_total}" > dataFile.txt 2> informationFile.txt

That way, the response will go to responseFile.html (or whatever you need), the progress information (stderr or stream 2) will go to informationFile.txt and the required request response code and time information will go to dataFile.txt


This is what you need:

curl -o gettext.html http://www.gnu.org/software/gettext/manual/gettext.html 2> details.txt

The above will save the url to gettext.html and curl details to details.txt.