Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure curl to only show percentage?

Is there an option for the curl command to show only a percentage output to shell rather than all of this, for example:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12.4M  100 12.4M    0     0  4489k      0  0:00:02  0:00:02 --:--:-- 4653k

Maybe there is a flag I can set? If not, pipe it somehow through a regular expression to show me a continuous update of the percentage only?

Thanks all

like image 652
Abs Avatar asked Jul 15 '09 15:07

Abs


People also ask

How do I hide my curl progress bar?

The procedure to hide curl progress bar is to pass the -s or --silent option to the curl command: Open the terminal application on your Linux/Unix. Type the command (pass -s option to curl to hide progress bar): $ curl -s https://your-dot-com-domain-name-here/ > /tmp/output.

How do you show curl progress?

curl features an alternative progress bar. When you invoke it with -# or the longer version –progress-bar, curl will show the transfer progress using a single “bar” on the screen instead of the default meter that shows a lot of data like amount of data, transfer speeds and times.

How do you ignore curl output?

The curl command with the -o /dev/null option can be used to suppress the response body output. Something like this should be displayed. If you also want to supress the progress bar, the -s or --silent flag can be used. Now the curl command returns no output.

What is option in curl command?

To specify the transfer rate using curl command in Linux The curl option also provides the option to limit the data transfer rate. The values can be described in bytes, kilobytes, megabytes or gigabytes having the suffix k,m, or g respectively. '–limit-rate' option is used to specify the transfer rate.


2 Answers

Two modifiers might help, although neither are exact: --silent will suppress all updates and --progress-bar will show a progress bar only.

Edit: One option to make things easier would be to make a wrapper using Expect to simplify the output to your shell script or whatever is listening to curl.

like image 194
Godeke Avatar answered Sep 28 '22 16:09

Godeke


Does the parameter -# solve your problem?

-#/--progress-bar

Make curl display progress information as a progress bar instead of the default statistics.

From here.

like image 40
schnaader Avatar answered Sep 28 '22 16:09

schnaader