output.md (1810B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Long: output 5 Arg: <file> 6 Short: o 7 Help: Write to file instead of stdout 8 Category: important output 9 Added: 4.0 10 Multi: per-URL 11 See-also: 12 - remote-name 13 - remote-name-all 14 - remote-header-name 15 Example: 16 - -o file $URL 17 - "http://{one,two}.example.com" -o "file_#1.txt" 18 - "http://{site,host}.host[1-5].example" -o "#1_#2" 19 - -o file $URL -o file2 https://example.net 20 --- 21 22 # `--output` 23 24 Write output to the given file instead of stdout. If you are using globbing to 25 fetch multiple documents, you should quote the URL and you can use `#` 26 followed by a number in the filename. That variable is then replaced with the 27 current string for the URL being fetched. Like in: 28 29 curl "http://{one,two}.example.com" -o "file_#1.txt" 30 31 or use several variables like: 32 33 curl "http://{site,host}.host[1-5].example" -o "#1_#2" 34 35 You may use this option as many times as the number of URLs you have. For 36 example, if you specify two URLs on the same command line, you can use it like 37 this: 38 39 curl -o aa example.com -o bb example.net 40 41 and the order of the -o options and the URLs does not matter, just that the 42 first -o is for the first URL and so on, so the above command line can also be 43 written as 44 45 curl example.com example.net -o aa -o bb 46 47 See also the --create-dirs option to create the local directories 48 dynamically. Specifying the output as '-' (a single dash) passes the output to 49 stdout. 50 51 To suppress response bodies, you can redirect output to /dev/null: 52 53 curl example.com -o /dev/null 54 55 Or for Windows: 56 57 curl example.com -o nul 58 59 Specify the filename as single minus to force the output to stdout, to 60 override curl's internal binary output in terminal prevention: 61 62 curl https://example.com/jpeg -o -