How to convert HTML file to text on Linux

How to convert HTML file to a text on Linux?

You can use html2text (can be installed on Fedora by yum install html2text):

$ html2text ${html_file}

${html_file} is the html file to be converted. The converted text will be printed to the STDOUT. You can redirect it to a file if it is needed.


Adding -style pretty can make html2text prints additional spaces/lines to make the text look more prettier.


The -width 100 option may help for pages that are rendered strangely.

Leave a Reply

Your email address will not be published. Required fields are marked *