write-out.d 6.3 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. Added: 6.5
  8. ---
  9. Make curl display information on stdout after a completed transfer. The format
  10. is a string that may contain plain text mixed with any number of
  11. variables. The format can be specified as a literal "string", or you can have
  12. curl read the format from a file with "@filename" and to tell curl to read the
  13. format from stdin you write "@-".
  14. The variables present in the output format will be substituted by the value or
  15. text that curl thinks fit, as described below. All variables are specified as
  16. %{variable_name} and to output a normal % you just write them as %%. You can
  17. output a newline by using \\n, a carriage return with \\r and a tab space with
  18. \\t.
  19. The output will be written to standard output, but this can be switched to
  20. standard error by using %{stderr}.
  21. .B NOTE:
  22. The %-symbol is a special symbol in the win32-environment, where all
  23. occurrences of % must be doubled when using this option.
  24. The variables available are:
  25. .RS
  26. .TP 15
  27. .B content_type
  28. The Content-Type of the requested document, if there was any.
  29. .TP
  30. .B errormsg
  31. The error message. (Added in 7.75.0)
  32. .TP
  33. .B exitcode
  34. The numerical exitcode of the transfer. (Added in 7.75.0)
  35. .TP
  36. .B filename_effective
  37. The ultimate filename that curl writes out to. This is only meaningful if curl
  38. is told to write to a file with the --remote-name or --output
  39. option. It's most useful in combination with the --remote-header-name
  40. option. (Added in 7.26.0)
  41. .TP
  42. .B ftp_entry_path
  43. The initial path curl ended up in when logging on to the remote FTP
  44. server. (Added in 7.15.4)
  45. .TP
  46. .B http_code
  47. The numerical response code that was found in the last retrieved HTTP(S) or
  48. FTP(s) transfer.
  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 transferred, 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 transferred, 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 have 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.