IT pill

Is there any tool equivalent to the option “Save for Web” present in IrfanView or Photoshop in Gimp for Linux?

Yes.
In Debian based distros you need to install the package gimp-plugin-registry and In CentOS the package is called gimp-save-for-web. Of course you need to install Gimp first.

IT pill

Is there any tool to validate HTML code in Linux?

Yes, certainly. You can download tidy (the HTML syntax checker).

Once downloaded you run it from the command line

$ tidy -e page.html

The above line will just display errors or warnings if any

$ tidy page.html

The above line will display any error or warning and the full HTML page as well

$ tidy -modify page.html

The above line will modify the original input file with a fixed version of it.

For more options, run – of course –$ man tidy.