output.d 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Long: output
  2. Arg: <file>
  3. Short: o
  4. Help: Write to file instead of stdout
  5. See-also: remote-name remote-name-all remote-header-name
  6. Category: important curl
  7. Example: -o file $URL
  8. Example: "http://{one,two}.example.com" -o "file_#1.txt"
  9. Example: "http://{site,host}.host[1-5].com" -o "#1_#2"
  10. Example: -o file $URL -o file2 https://example.net
  11. ---
  12. Write output to <file> instead of stdout. If you are using {} or [] to fetch
  13. multiple documents, you should quote the URL and you can use '#' followed by a
  14. number in the <file> specifier. That variable will be replaced with the current
  15. string for the URL being fetched. Like in:
  16. curl "http://{one,two}.example.com" -o "file_#1.txt"
  17. or use several variables like:
  18. curl "http://{site,host}.host[1-5].com" -o "#1_#2"
  19. You may use this option as many times as the number of URLs you have. For
  20. example, if you specify two URLs on the same command line, you can use it like
  21. this:
  22. curl -o aa example.com -o bb example.net
  23. and the order of the -o options and the URLs doesn't matter, just that the
  24. first -o is for the first URL and so on, so the above command line can also be
  25. written as
  26. curl example.com example.net -o aa -o bb
  27. See also the --create-dirs option to create the local directories
  28. dynamically. Specifying the output as '-' (a single dash) will force the
  29. output to be done to stdout.
  30. To suppress response bodies, you can redirect output to /dev/null:
  31. curl example.com -o /dev/null
  32. Or for Windows use nul:
  33. curl example.com -o nul