mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 08:08:02 +00:00
Add Run A cURL Command Without The Progress Meter as a Unix TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||
|
||||
_1320 TILs and counting..._
|
||||
_1321 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -1316,6 +1316,7 @@ _1320 TILs and counting..._
|
||||
- [Repeat Yourself](unix/repeat-yourself.md)
|
||||
- [Replace Pattern Across Many Files In A Project](unix/replace-pattern-across-many-files-in-a-project.md)
|
||||
- [Run A Command Repeatedly Several Times](unix/run-a-command-repeatedly-several-times.md)
|
||||
- [Run A cURL Command Without The Progress Meter](unix/run-a-curl-command-without-the-progress-meter.md)
|
||||
- [Safely Edit The Sudoers File With Vim](unix/safely-edit-the-sudoers-file-with-vim.md)
|
||||
- [Saying Yes](unix/saying-yes.md)
|
||||
- [Search Files Specific To A Language](unix/search-files-specific-to-a-language.md)
|
||||
|
||||
30
unix/run-a-curl-command-without-the-progress-meter.md
Normal file
30
unix/run-a-curl-command-without-the-progress-meter.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Run A cURL Command Without The Progress Meter
|
||||
|
||||
By default when you run a `curl` command that will output to the terminal, it
|
||||
disables the progress meter for the request. When the response output is
|
||||
redirected or piped somewhere else however, the progress meter will be
|
||||
displayed in the terminal.
|
||||
|
||||
```bash
|
||||
$ curl -H "Content-Type: application/json" -G http://myurl.com | jq
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
Dload Upload Total Spent Left Speed
|
||||
100 2515 0 2515 0 0 4184 0 --:--:-- --:--:-- --:--:-- 4184
|
||||
```
|
||||
|
||||
This can be disabled with the `-s` flag (which is short for `--silent`).
|
||||
|
||||
```bash
|
||||
$ curl -s -H "Content-Type: application/json" -G http://myurl.com | jq
|
||||
```
|
||||
|
||||
However, the `-s` flag will also suppress error messages. This is a bit
|
||||
unhelpful. You can then add in the `-S` flag (short for `--show-error`) to
|
||||
ensure that error messages are shown even while the progress meter is
|
||||
suppressed.
|
||||
|
||||
```bash
|
||||
$ curl -sS -H "Content-Type: application/json" -G http://myurl.com | jq
|
||||
```
|
||||
|
||||
See `man curl` for more details.
|
||||
Reference in New Issue
Block a user