Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

How do you redirect wget response to standard out?

Writer 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/null

Anyone know?

5

5 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-

7

A simpler version

wget -qO- 

equivalent to

wget -q -O - 

where

  • -q turns 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.
2
wget -qO /dev/null 
  • -q to make it quiet
  • -O /dev/null to ignore the page contents
0

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy