These curl recipes show you how to save the response from a curl request to a file. By default, curl prints the response to screen. To make it save the response to a file, use the -o file command line option.

Save the Response from a GET Request to a File

curl -o response.txt

In this recipe, curl uses the -o response.txt command line option to save the response from a GET request that it makes to to a file with filename response.txt.

Use the Last Fragment of a URL as the Filename

curl -O

This recipe uses the -O argument that forces curl to use the last part of the URL as the filename. In this case, the URL is and the last part of the URL is As a result, curl will create a new file and put the response body there.

Created by Browserling

These curl recipes were written down by me and my team at Browserling. We use recipes like this every day to get things done and improve our product. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!

Secret message: If you love my curl recipe, then I love you, too! Use coupon code CURLLING to get a discount at my company.