how to view a doc from command line? [duplicate]

As I mentioned there , how can I view documents( ex: .doc,.docx and all other formats ) from the command line ? Is there any way ?

Thank you.


I have been using the following setup in several scripts (especially with version control):

sudo apt-get install unoconv odt2txt     # installs both tools
doc2odt test.doc                         # creates test.odt
odt2txt test.odt                         # displays the contents in the terminal

or for a docx file:

docx2txt test.docx                       # converts docx file
less test.txt                            # read the contents

Works like a charm and you can read your doc files in the terminal. This method is more complex than catdoc but it has the advantage that entries from a bibliographic management system are not displayed in their raw form.

For a LaTex file you can just your favorite terminal text editor to open and read it.


To View word documents from the command line I found one named as catdoc.

to install it sudo apt-get install catdoc

then

catdoc -t filename.doc

You can specify the output format using the -a (text) or -t (LaTeX) option