write-out.d 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. Long: write-out
  2. Short: w
  3. Arg: <format>
  4. Help: Use output FORMAT after completion
  5. Category: verbose
  6. Example: -w '%{http_code}\\n' $URL
  7. ---
  8. Make curl display information on stdout after a completed transfer. The format
  9. is a string that may contain plain text mixed with any number of
  10. variables. The format can be specified as a literal "string", or you can have
  11. curl read the format from a file with "@filename" and to tell curl to read the
  12. format from stdin you write "@-".
  13. The variables present in the output format will be substituted by the value or
  14. text that curl thinks fit, as described below. All variables are specified as
  15. %{variable_name} and to output a normal % you just write them as %%. You can
  16. output a newline by using \\n, a carriage return with \\r and a tab space with
  17. \\t.
  18. The output will be written to standard output, but this can be switched to
  19. standard error by using %{stderr}.
  20. .B NOTE:
  21. The %-symbol is a special symbol in the win32-environment, where all
  22. occurrences of % must be doubled when using this option.
  23. The variables available are:
  24. .RS
  25. .TP 15
  26. .B content_type
  27. The Content-Type of the requested document, if there was any.
  28. .TP
  29. .B errormsg
  30. The error message. (Added in 7.75.0)
  31. .TP
  32. .B exitcode
  33. The numerical exitcode of the transfer. (Added in 7.75.0)
  34. .TP
  35. .B filename_effective
  36. The ultimate filename that curl writes out to. This is only meaningful if curl
  37. is told to write to a file with the --remote-name or --output
  38. option. It's most useful in combination with the --remote-header-name
  39. option. (Added in 7.26.0)
  40. .TP
  41. .B ftp_entry_path
  42. The initial path curl ended up in when logging on to the remote FTP
  43. server. (Added in 7.15.4)
  44. .TP
  45. .B http_code
  46. The numerical response code that was found in the last retrieved HTTP(S) or
  47. FTP(s) transfer. In 7.18.2 the alias **response_code** was added to show the
  48. same info.
  49. .TP
  50. .B http_connect
  51. The numerical code that was found in the last response (from a proxy) to a
  52. curl CONNECT request. (Added in 7.12.4)
  53. .TP
  54. .B http_version
  55. The http version that was effectively used. (Added in 7.50.0)
  56. .TP
  57. .B json
  58. A JSON object with all available keys.
  59. .TP
  60. .B local_ip
  61. The IP address of the local end of the most recently done connection - can be
  62. either IPv4 or IPv6. (Added in 7.29.0)
  63. .TP
  64. .B local_port
  65. The local port number of the most recently done connection. (Added in 7.29.0)
  66. .TP
  67. .B method
  68. The http method used in the most recent HTTP request. (Added in 7.72.0)
  69. .TP
  70. .B num_connects
  71. Number of new connects made in the recent transfer. (Added in 7.12.3)
  72. .TP
  73. .B num_headers
  74. The number of response headers in the most recent request (restarted at each
  75. redirect). Note that the status line IS NOT a header. (Added in 7.73.0)
  76. .TP
  77. .B num_redirects
  78. Number of redirects that were followed in the request. (Added in 7.12.3)
  79. .TP
  80. .B onerror
  81. The rest of the output is only shown if the transfer returned a non-zero error
  82. (Added in 7.75.0)
  83. .TP
  84. .B proxy_ssl_verify_result
  85. The result of the HTTPS proxy's SSL peer certificate verification that was
  86. requested. 0 means the verification was successful. (Added in 7.52.0)
  87. .TP
  88. .B redirect_url
  89. When an HTTP request was made without --location to follow redirects (or when
  90. --max-redirs is met), this variable will show the actual URL a redirect
  91. *would* have gone to. (Added in 7.18.2)
  92. .TP
  93. .B referer
  94. The Referer: header, if there was any. (Added in 7.76.0)
  95. .TP
  96. .B remote_ip
  97. The remote IP address of the most recently done connection - can be either
  98. IPv4 or IPv6. (Added in 7.29.0)
  99. .TP
  100. .B remote_port
  101. The remote port number of the most recently done connection. (Added in 7.29.0)
  102. .TP
  103. .B response_code
  104. The numerical response code that was found in the last transfer (formerly
  105. known as "http_code"). (Added in 7.18.2)
  106. .TP
  107. .B scheme
  108. The URL scheme (sometimes called protocol) that was effectively used. (Added in 7.52.0)
  109. .TP
  110. .B size_download
  111. The total amount of bytes that were downloaded. This is the size of the
  112. body/data that was transfered, excluding headers.
  113. .TP
  114. .B size_header
  115. The total amount of bytes of the downloaded headers.
  116. .TP
  117. .B size_request
  118. The total amount of bytes that were sent in the HTTP request.
  119. .TP
  120. .B size_upload
  121. The total amount of bytes that were uploaded. This is the size of the
  122. body/data that was transfered, excluding headers.
  123. .TP
  124. .B speed_download
  125. The average download speed that curl measured for the complete download. Bytes
  126. per second.
  127. .TP
  128. .B speed_upload
  129. The average upload speed that curl measured for the complete upload. Bytes per
  130. second.
  131. .TP
  132. .B ssl_verify_result
  133. The result of the SSL peer certificate verification that was requested. 0
  134. means the verification was successful. (Added in 7.19.0)
  135. .TP
  136. .B stderr
  137. From this point on, the --write-out output will be written to standard
  138. error. (Added in 7.63.0)
  139. .TP
  140. .B stdout
  141. From this point on, the --write-out output will be written to standard output.
  142. This is the default, but can be used to switch back after switching to stderr.
  143. (Added in 7.63.0)
  144. .TP
  145. .B time_appconnect
  146. The time, in seconds, it took from the start until the SSL/SSH/etc
  147. connect/handshake to the remote host was completed. (Added in 7.19.0)
  148. .TP
  149. .B time_connect
  150. The time, in seconds, it took from the start until the TCP connect to the
  151. remote host (or proxy) was completed.
  152. .TP
  153. .B time_namelookup
  154. The time, in seconds, it took from the start until the name resolving was
  155. completed.
  156. .TP
  157. .B time_pretransfer
  158. The time, in seconds, it took from the start until the file transfer was just
  159. about to begin. This includes all pre-transfer commands and negotiations that
  160. are specific to the particular protocol(s) involved.
  161. .TP
  162. .B time_redirect
  163. The time, in seconds, it took for all redirection steps including name lookup,
  164. connect, pretransfer and transfer before the final transaction was
  165. started. time_redirect shows the complete execution time for multiple
  166. redirections. (Added in 7.12.3)
  167. .TP
  168. .B time_starttransfer
  169. The time, in seconds, it took from the start until the first byte was just
  170. about to be transferred. This includes time_pretransfer and also the time the
  171. server needed to calculate the result.
  172. .TP
  173. .B time_total
  174. The total time, in seconds, that the full operation lasted.
  175. .TP
  176. .B url
  177. The URL that was fetched. (Added in 7.75.0)
  178. .TP
  179. .B urlnum
  180. The URL index number of this transfer, 0-indexed. De-globbed URLs share the
  181. same index number as the origin globbed URL. (Added in 7.75.0)
  182. .TP
  183. .B url_effective
  184. The URL that was fetched last. This is most meaningful if you've told curl
  185. to follow location: headers.
  186. .RE
  187. .IP
  188. If this option is used several times, the last one will be used.