1. Introduction
In this short article, we show how to capture curl output to a file..
2. Capture curl output to a file using -o, --output <file>
parameter
If we use the -o
parameter curl will write output to <file>
instead of stdout.
The following command will write output to a file.txt
file:
3. Save request output to a file using -O
parameter
For a single file we could use just -O
param instead of -o <file>
:
In this approach, the last segment of the URL path will be used as the filename.
4. Conclusion
In this short article, we presented how to capture the output of curl request into a file.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}