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

How can I have wget print errors, but nothing otherwise?

In the default behavior, it shows a progress bar and lots of stuff.

In the --no-verbose version still prints one line per downloaded file, this I don't want.

The --quiet option causes it to be totally quiet, even in the case of an error, it doesn't print anything.

Is there a mode in which it prints errors, but nothing else?

share|improve this question

Use curl, no point guessing what every error will look like.

[wizard@laptop ~] curl -s -S > /dev/null && echo "TRUE"
curl: (6) Couldn't resolve host ''
[wizard@laptop ~]$ curl -s -S > /dev/null && echo "TRUE"


Silent mode. Don’t show progress meter or error messages. Makes Curl mute.


When used with -s it makes curl show error message if it fails.

And if you need stderr on stdout for some reason.

curl -s -S  2>&1 1> /dev/null
share|improve this answer
up vote 4 down vote accepted

There are very good answers in this question, be sure to check them out, but what I've done is this:

wget [wget options] 2>&1 | grep -i "failed\|error"
share|improve this answer

I don't see an option for that. Do you need to know what the error is, or just if it happened? If you happen to just need to know if there was error, you can use the exit status.

if ! wget -o /dev/null; then
    echo 'Oops!'

Or, maybe:

if ! wget -o logfile; then
    cat logfile

And you can change the cat to a grep command if you want to get fancy...

share|improve this answer
More simple way: wget -o logfile <url> || cat logfile – kolypto Oct 4 '09 at 11:20
The more simple way is worse since you probably want to exit or do something different on error, in addition to displaying the error message. – Sam Watkins Jun 20 at 0:23

Redirect standard output to /dev/null, but keep the error output in your choice of shell.

In bash this would be:

wget [wget options] > /dev/null

Edit: So wget misbehaves. If all errors contain the word "error" in them you could pipe to grep

wget [wget options] 2>&1 | grep -i "error"
share|improve this answer
wget seems to send everything to stderr. – J. Pablo Fernández Oct 2 '09 at 19:16
I added another option using grep to only output errors – Ben S Oct 2 '09 at 19:19
stderr doesn't go through the pipe without help. – Dennis Williamson Oct 2 '09 at 19:34
In the end I used wget [wget options] 2>&1 | grep -i "failed\|error" – J. Pablo Fernández Oct 2 '09 at 19:37

Since wget outputs all messages on stderr, you have to use redirection before you can pipe it to grep:

wget [options] 2>&1 | grep "^wget:"

This assumes that wget begins its error lines with "wget:".

share|improve this answer
Thanks for pointing this out. – Ben S Oct 2 '09 at 19:42

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.