output.d 1.5 KB

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