The profound rantings of the one like Tom Atkinson… and now art gallery and shop.

How to use WGET to show HTML source code

If you are logged into a Unix shell, say like the Terminal on Mac OS X, or bash in Linux, sometimes you want to show a web pages source code. I use this for checking a pages source code from another location outside my network. This is helpful if you have a strong proxy server that is preventing you from getting the latest copy of a webpage during development.

Display the HTML source code for

wget -qO- | cat

There you have it.

If you actually want to save the file to a local file and also display it, use this instead:

wget -q -O file "url"; cat file
Posted by tomachi on January 20th, 2010 filed in Unix