746

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.

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
adammenges
  • 7,848
  • 5
  • 26
  • 33
  • 25
    `curl -s http://google.com` is silent for me over here. Which version of curl and Linux are you on? – Adrian Petrescu Sep 10 '11 at 18:33
  • -s works fine for me in curl 7.21.0 (i686-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18 and curl 7.19.5 (i386-apple-darwin9.7.0) libcurl/7.19.5 zlib/1.2.3 looks like u need upgrade your curl – derevo Sep 10 '11 at 18:38
  • I've tried it on Fedora 15, and Mac OSX 10.7.1. Also, 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. – adammenges Sep 10 '11 at 18:40
  • for me works with curl `7.22.0-3ubuntu4.11` (Ubuntu 12.04) and `7.35.0-1ubuntu2.2` (Ubuntu 14.04). – Dimitry K Dec 06 '14 at 19:04
  • 1
    For anyone who wants to figure out version of installed `curl` and `libcurl` use command `dpkg -l | grep curl` – Dimitry K Dec 06 '14 at 19:04
  • 2
    In such a case, run `man curl` for showing manual page of curl, then hit `/progress` or `/hide progress` or `stop` or whatever for searching query to get what you want. Then you can reach an answer like chmac suggested. – kenju Aug 23 '15 at 04:26

7 Answers7

720
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
unutbu
  • 842,883
  • 184
  • 1,785
  • 1,677
  • 45
    I should have thought of that. It'll hide error messages too, though. – Tom Zych Sep 10 '11 at 19:21
  • 1
    In my case, it's okay to use /dev/null. – adammenges Nov 08 '12 at 17:13
  • Nice - this works great. I had the problem on centOS 6.3, but not on other distros - bizarre, but simple easy workaround - thx! – Ross Apr 14 '13 at 16:12
  • 1
    by the way, see below link about `2>/dev/null` if you don't know: http://stackoverflow.com/questions/10508843/what-is-dev-null-21 – kenju Aug 23 '15 at 04:24
  • 1
    According to the man page for an installation of curl on an ubuntu 14 host, `-s` will make curl not "show progress meter or *error messages*". (I haven't tried testing or reading source code to see if that is really true.) – David Winiecki Aug 22 '18 at 21:51
  • 1
    It's an old question, maybe this wasn't possible back then: According to Gonzalo Cao on https://unix.stackexchange.com/questions/196549/hide-curl-output/362760, you can use "curl -s -S 'example.com' > /dev/null" if you only want errors. I'm no expert on this myself though... – Kenny Nov 06 '19 at 12:01
  • 1
    I recommend people to use `--no-progress-meter` instead to only hide the bar without muting other warnings. See https://stackoverflow.com/a/21109454/2461761. – Tony Jan 28 '22 at 03:09
  • This answer is incorrect because it hides everything, not just progress bar. It's like using a tactical nuke to kill a mosquito, and it should be unchecked. – Igor Levicki Feb 13 '23 at 21:26
691

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.

chmac
  • 11,757
  • 3
  • 32
  • 36
  • 4
    For my 7.35 using -sS eliminates the progress meter but ALSO eliminates the info normally written to stdout - which I need, since it includes the file name as written to disk instead of the (different) fileid which must be used in the request. There seems no way to simply defeat the progress meter alone! – Jack Jan 17 '17 at 00:38
  • 7
    @Jack Since curl 7.67.0 there is `--no-progress-meter`, see [my answer below](https://stackoverflow.com/a/65620137/895727). – clonejo Jan 12 '21 at 18:47
56

Since curl 7.67.0 (2019-11-06) there is --no-progress-meter, which does exactly this, and nothing else. From the man page:

   --no-progress-meter
         Option to switch off the progress meter output without muting or
         otherwise affecting warning and informational messages like  -s,
         --silent does.

         Note  that  this  is the negated option name documented. You can
         thus use --progress-meter to enable the progress meter again.

         See also -v, --verbose and -s, --silent. Added in 7.67.0.

It's available in Ubuntu ≥20.04 and Debian ≥11 (Bullseye).

For a bit of history on curl's verbosity options, you can read Daniel Stenberg's blog post.

clonejo
  • 821
  • 7
  • 15
51

I found that with curl 7.18.2 the download progress bar is not hidden with:

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

but it is with:

curl -ss http://google.com > temp.html
Bill Healey
  • 922
  • 8
  • 5
7

Not sure why it's doing that. Try -s with the -o option to set the output file instead of >.

Tom Zych
  • 13,329
  • 9
  • 36
  • 53
-1

On macOS 10.13.6 (High Sierra), the -sS option works. It is especially useful inside Perl, in a command like curl -sS --get {someURL}, which frankly is a whole lot more simple than any of the LWP or HTTP wrappers, for just getting a website or web page's contents.

jcollum
  • 43,623
  • 55
  • 191
  • 321
RLynch59
  • 9
  • 1
-2

this could help..

curl 'http://example.com' > /dev/null
  • 3
    Read the question again: OP wants to redirect the result into a file. `> /dev/null` would discard it. As mentioned in the already accepted answer, `2> /dev/null` (redirect stderr) would hide the progress bar. – fcdt Oct 01 '20 at 14:51