Hide cURL Outputs and Errors on Terminal

If you have a use case where you want to hide what is outputted on the Terminal when you run a cURL request, then you would have to do a combination of steps.

Example 1: Hide the Progress Meter

If you do not want to see the progress details then make use of the option --no-progress-meter

Example: With Progress Meter
% curl -o sample.html http://example.com
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1256  100  1256    0     0   2868      0 --:--:-- --:--:-- --:--:--  2907

Example: Without Progress Meter
% curl -o sample.html --no-progress-meter http://example.com
cURL with option to hide progress meter

As you can see using --no-progress-meter you do not see the meter and the file is saved without any output on the console.

Example 2: Hide outputs using --silent or -s option

-s or --silent is a flag you can use with cURL to execute your request in quiet mode, it will not show the progress meter or any error messages on the console.

% curl -s -o sample.html http://example.com
Silent option with cURL to hide output

Note: Make use of --show-error with -s option to disable the progress meter but to display error messages.

Example 3: Hide all cURL Request Outputs

If you do not want to display any output text be it progress, output data, or error messages then you will need to make use of the combination of --silent and redirect the output to /dev/null

% curl --silent http://example.com > /dev/null
% curl -s -o /dev/null http://example.com
Do not show any text in output cURL

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap