Posted By

noah on 02/05/10


curl command Shell Bash html console pipe validation line dos validate on cygwin cmd the one-liners oneliners lwp-request one liners

Versions (?)

Howto run Tidy from the command line

 / Published in: Bash

This shell command will retrieve a Web page and validate the HTML with Tidy, the HTML linter from the W3. You can get an XHTML validation report right in your shell prompt, just like you'd get from the Firefox extension or the Web service.. It's especially helpful when you need to validate HTML on your intranet, or behind a firewall.

NOTE: Curl does not follow redirects by default!

By default, Curl retrieves exactly the URL you specify. The -L option causes Curl to follow redirects just like a Web browser would.

NOTE: Tidy produces a lot of output!

Windows users should make sure their command prompt screen buffer height is set to 9999 so that you don't "lose" any output.

Explanation of the command line options

curl -L tells Curl to foLLow HTTP redirects

curl -s Suppresses Curl's annoying progress bar

tidy -e tells Tidy not to Emit the tidied HTML to the console

tidy -q tells Tidy to be Quiet, instead of printing extra crap at the bottom of the report


Curl and Tidy are installed via the Cygwin setup.exe

Alternately, Perl hackers could use lwp-request.

Doing more

Validate HTML with a stricter algorithm, using the OpenJade SGML parser.

Validate linked pages with Tidy and lwp-request.

  1. curl -Ls | tidy -eq

Report this snippet  

You need to login to post a comment.