Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get cURL to not show the progress bar?

I'm trying to use cURL in a script and get it to not show the progress bar.

I've tried the -s, -silent, -S, and -quiet options, but none of them work.

Here's a typical command I've tried:

curl -s http://google.com > temp.html 

I only get the progress bar when pushing it to a file, so curl -s http://google.com doesn't have a progress bar, but curl -s http://google.com > temp.html does.

like image 555
adammenges Avatar asked Sep 10 '11 18:09

adammenges


People also ask

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.

How do you use curl and grep?

Using Curl Options to Allow GrepThe --stderr option in curl allows you to redirect the standard error (STDERR) to a file. If you specify the filename as - (a single dash) the output will be written to standard output. This allows you to pipe it to grep without any shell redirection.

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.

What is flag in curl?

What is a flag in Curl? A flag is a command-line parameter that denotes a specific action in Curl. Curl has over three hundred command-line options, and the number of options increases over time. You can add the listed flags to the Curl command and enter the URL.


2 Answers

curl -s http://google.com > temp.html 

works for curl version 7.19.5 on Ubuntu 9.10 (no progress bar). But if for some reason that does not work on your platform, you could always redirect stderr to /dev/null:

curl  http://google.com 2>/dev/null > temp.html 
like image 50
unutbu Avatar answered Oct 08 '22 00:10

unutbu


In curl version 7.22.0 on Ubuntu and 7.24.0 on OSX the solution to not show progress but to show errors is to use both -s (--silent) and -S (--show-error) like so:

curl -sS http://google.com > temp.html 

This works for both redirected output > /some/file, piped output | less and outputting directly to the terminal for me.

Update: Since curl 7.67.0 there is a new option --no-progress-meter which does precisely this and nothing else, see clonejo's answer for more details.

like image 38
chmac Avatar answered Oct 08 '22 00:10

chmac