curl hide progress bar output on Linux/Unix shell scripts

I am a new Ubuntu Linux user. I am writing a shell script and using the curl command to grab URL output using curl$key/hash.html. However, the curl command is outputting complete progress information that my script does not need it. How can I get curl command not to show the progress bar output? How can I hide curl command output? Is there is a simple way for silencing curl’s progress output on an Ubuntu Linux desktop?

Introduction: cUrl is both an application library and command for downloading files or performing requests on the Web. The curl command works on Linux, Windows, macOS, *BSD and Unix-like system. This page shows how to hide progress bar output on a Linux or Unix-like system when using the curl command.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements curl on Linux or Unix
Est. reading time 4 minutes

curl hide progress bar output when using shell scripts

The procedure to hide curl progress bar is to pass the -s or --silent option to the curl command:

  1. Open the terminal app
  2. Type the command: curl -s > /tmp/output.html
  3. Verify it with the cat command: cat /tmp/output.html

Let us see all commands and some examples in details.

How can I get cURL not show the progress bar on Linux

Consider the following simple command:
$ curl > /tmp/output.html

How to silencing curl command’s progress output

Run command:
$ curl -s > /tmp/output.html
$ curl --silent > /tmp/output.html
You can use the grep command or egrep command as follows too:
$ curl -s | grep -A 2 '<td id="latest_button">'

Understanding the -s and -S options

From the curl man page:

The -s or --silent option act as silent or quiet mode. Don’t show progress meter or error messages. Makes Curl mute. It will still output the data you ask for, potentially even to the terminal/stdout unless you redirect it.

Use -S, --show-error in addition to this option to disable progress meter but still show error messages.

The following command will silence the progress output without silencing real errors:
$ curl -sS > /tmp/out.txt
$ curl -sS > /dev/null

Eliminating progress bar on an older version of curl running on Unix-like system

If you are using an older version of curl and cannot update curl that has -s option, try:
$ curl 2>/dev/null > /tmp/nix.html
$ curl 2>/dev/null | grep '<title>'

Hiding curl output in shell scripts

The syntax is same. For example see if remote web-server produce ‘HTTP/2 200’ code as follows
curl -s -I | grep 'HTTP/2 200'
Let us try out:

#!/usr/bin/env bash
# Purpose: Check whether a website is up or down using the CLI
# Author: Vivek Gite {} under GPL v2.x+
# Requirments: Bash v3.x+ and curl running on Linux/Unix-like systems
# -------------------------------------------------------------------
if [ "$r" == "" ]
	echo "Usage: $0 url"
	exit 1
out=$(curl -k -I -L -s  "$r" | grep -E -i 'http/[[:digit:]]*')
if [ "$out" != "" ]
	if [[ $out =~ .*200.* ]] 
		echo "✅ Site is up with HTTP code 200"
		echo "❌ Site did not return HTTP code 200"
		echo "Headers info for $r:"
		echo "$out"

Run it as follows:
./script domain

cURL suppress response body by hiding output from the CLI

Here is a one-liner instead of shell script:
curl -L -o /dev/null -s -I -w '%{http_code}\n' url
curl -L -o /dev/null -s -I -w '%{http_code}\n'

Understanding hide curl output options

Option used to hide curl output are as follows:

  • -s : Hide curl output especially progress bar.
  • -k : Allows curl to proceed and operate even for server connections otherwise considered insecure. For example, self-singed TLS.
  • -I : Fetch the HTTP headers only.
  • -L : Follow URL/domain when we see header and a 3XX response code.
  • -o /dev/null : Sed output to /dev/null instead of stdout (screen). See BASH Shell Redirect Output and Errors To /dev/null for more info.
  • -w '%{http_code}\n' : Display the numerical response code that was found in the last retrieved HTTP(S) or FTP(s) transfer. The -w option forces curl to show information on screen after a completed transfer.

The grep command/egrep command used to filter curl command HTTP headers:

  • -E : Turn on extended regular expressions with grep.
  • -i : Ignore case. In other words match HTTP, http, and so on.


You just learned how to eliminating curl command’s progress bar output when using with shell scripts. For more info see curl command man page:
$ man curl

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Venkat May 30, 2021 @ 17:05

    How do I mute or hide Connection #0 message in out put. Since it is writting into my script output and its overriding my output

    • 🐧 Vivek Gite May 30, 2021 @ 18:15

      Can you post your curl command and its output?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum