Wget output document and headers to STDOUT

user1239398 picture user1239398 · Aug 25, 2012 · Viewed 164.4k times · Source

I'm trying to output the document body and its headers to STDOUT by doing

wget -S -O - http://google.com

...but it shows only the HTML document.

Update: Got it to work with

wget --save-headers --output-document - http://google.com

wget --version shows my version is GNU Wget 1.11.4 Red Hat modified.

Answer

Joseph Lust picture Joseph Lust · Apr 8, 2014

Try the following, no extra headers

wget -qO- www.google.com

Note the trailing -. This is part of the normal command argument for -O to cat out to a file, but since we don't use > to direct to a file, it goes out to the shell. You can use -qO- or -qO -.