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