How do you redirect wget response to standard out?
Olivia Zamora
I have a crontab that wgets a PHP page every five minutes (just to run some the PHP code), and I want to send the output of the request to standard out, while sending the normal wget output to /dev/null (or otherwise hide it). I couldn't find it in the wget manual.
I'm looking for something like:
wget -o stdout > /dev/nullAnyone know?
55 Answers
wget -O - > /dev/null
or, if you want to redirect standard error output also:
wget -O - > /dev/null 2>&1
or, for codegolf :-)
wget -O-
A simpler version
wget -qO- equivalent to
wget -q -O - where
-qturns off the output of log, including error information-O -, equivlalent to-O /dev/stdout, means dump the web page to a file named/dev/stdout.
wget -qO /dev/null -qto make it quiet-O /dev/nullto ignore the page contents
You can also try:
wget -q -O - > /dev/null the -q will make it "quiet"
Or have the file go to some temp html page that you don't mind having.
wget -O /dev/null 3