Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

In a bash script, I must download a file from the web. I the wget command for doing this. I would like to log the output of the wget command, and at "the same time" have the output prompting on terminal.

I searched in the man wget without finding the way to achieve that.

It seems that if you turn on the log with -o or -a parameter, then the prompt output is automatically 'redirected' to the log file, and nothing is shown on the terminal while executing the script, until it has completed the download.

wget -a wget_log --no-check-certificate --auth-no-challenge --http-user=$jen_uname --http-password=$jen_psswd link_to_the_file

Is it possible to do both? Output on prompt and writing on log file?

share|improve this question
Just to be clear - you want the output of wget to go both to a log file and to the terminal? – mjturner May 8 '14 at 12:39
exactly. i will try to edit the question to be more clear. – lese May 8 '14 at 12:58

1 Answer 1

up vote 6 down vote accepted

You use the lovely tee command to do this:

wget --no-check-certificate --auth-no-challenge --http-user=$jen_uname --http-password=$jen_psswd 2>&1 | tee -a wget_log

THe 2>&1 means that STDERR goes to the same place as STDOUT, and they're both piped to tee. The -a means append. tee will then send the output both to wget_log and to STDOUT.

share|improve this answer
great! thankyou jenny for the clear explaination! – lese May 8 '14 at 14:47

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.