Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I'm trying to see if a server I'm running has been stopped (if it has, it returns a 502 Bad Gateway message.)

So I tried to do this :

curl http://MY_URL | grep "502"

The curl part returns what I expect it to.

But when I pipe it into grep, grep seems to be adding a bunch of headings :

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
113   682  113   682    0     0   230k      0 --:--:-- --:--:-- --:--:--  666k

These aren't in the output from curl. And grep on ordinary text files doesn't add them. So why are they getting added to curl piped through grep?

share|improve this question
up vote 1 down vote accepted

That output is from curl. It's added when standard output is not a terminal, and in some other circumstances. Use curl -s if you don't want to see it.

share|improve this answer
Weird behaviour though, isn't it? To produce different output depending on whether it's going to the terminal or stdout. I thought unix tools were meant to ignore that kind of context. – interstar Mar 18 '13 at 0:43
Don't ask me, I didn't write it. – Michael Hampton Mar 18 '13 at 0:45

It is not a grep proble, but a curl feature. Try it with cat and you will see.

You can deal around it with -s (suppress the progress meter), an -o output .

Man curl for more.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.