1

When I run

curl example.com > example.html

on the terminal, I get the progress meter as follows

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1256  100  1256    0     0   1950      0 --:--:-- --:--:-- --:--:--  1947
100  1256  100  1256    0     0   1950      0 --:--:-- --:--:-- --:--:--  1947

According to https://curl.se/docs/manpage.html it is necessary to redirect the curl stdout to a file in order to have this message displayed. "If you want a progress meter for HTTP POST or PUT requests, you need to redirect the response output to a file, using shell redirect (>), --output or similar." If I run

curl example.com 2> progress.txt

there is no data in progress.txt. Therefore I need to run

curl example.com > example.html 2> progress.txt

How can I access the progress meter without redirecting the curl stdout to a file?

1 Answer 1

1

If you pipe the data to another program, you’ll get the progress meter. A basic

curl example.com | cat

works, but with longer results you’ll run into the issue mentioned in the documentation:

it disables the progress meter as otherwise it would mess up the output mixing progress meter and response data

To avoid that, use sponge (from moreutils, available in most distributions):

curl example.com | sponge

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .