HomecurlcURL - How to hide progress bar?

cURL – How to hide progress bar?

In this guide we are going to discuss what is progress meter in cURL and how to disable or hide progress bar to not show in cURL command output results.

curl - how to hide progress bar

1. What is Progress Meter?

Progress meter in cURL is a formatted text console output that shows the amount of data transferred, speed, estimated time etc information. cURL displays progress meter by default for each operation. You can refer above image for the example of Progress Meter information. If you would like to display bar instead meter you can us -# OR –progress-bar in the command. Following is the example to show progress bar.

Progress Bar Example:

curl -# https://jsonplaceholder.typicode.com/posts/1

######################################################################## 100.0%{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}

2. Hide Progress Meter/Bar

Some times you would not want to show progress meter/bar in the command line output, specifically in shell scripting. To not show progress meter you can use --no-progress-meter in the command, it disables progress meter in the output. If you would wontedly to show the progress meter use --progress-meter in the cURL command.

$ curl --no-progress-meter https://jsonplaceholder.typicode.com/posts/1

{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}

3. Not display using -s Option

You can also disable progress meter using -s OR --silent in the command line, which will completely silent disable the progress meter.

$ curl -s https://jsonplaceholder.typicode.com/posts/1

{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}

Sometimes we need to show error if it fails, if we use -S OR --show-error along with -s, it makes error visible in the output if the operation fails. If you would like to show the error if operation fails, then use -sS in the command.

$ curl -sS https://jsonplaceholder.typicode.com/posts/1

4. Conclusion

In this guide, we have discussed how to disable/hide progress meter/bar in cURL command output with several examples.

5. References

  1. cURL Man
  2. cURL – POST Request

LEAVE A REPLY

Please enter your comment!
Please enter your name here