how to view a doc from command line?

18,480

Solution 1

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.

Solution 2

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

Share:
18,480

Related videos on Youtube

mx7
Author by

mx7

LinkedIn Profile: https://in.linkedin.com/in/raja-genupula-05205531 Endorse me If I helped you. Blog : http://thelinuxmen.blogspot.com/ Ubuntu - CentOS - Fedora - Windows - Severs - IIS - FTP - Security Thank you.

Updated on September 18, 2022

Comments

  • mx7
    mx7 almost 2 years

    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.

    • simbadub23
      simbadub23 over 10 years
      It is a terminal, not a word processor! So basically, it's not possible.
    • mx7
      mx7 over 10 years
      @FreudianSlip any , just want to view it with out any much modifications to the content.
  • mx7
    mx7 over 10 years
    Hey , thanks for looking my post. could you explain this little bit " the advantage that entries from a bibliographic management system are not displayed in their raw form"
  • don.joey
    don.joey over 10 years
    For academic writing people might use things like Mendeley, Endnote, JabRef to manage their citation references . With catdoc these appear as [ADDIN: {author: Don Joey} { title: ...} ...]. When you have many of them that is hard to read. This is where odt2txt conversion comes in handy because you will just see Don Joey, Some Supposedly Interesting Book,... rather than the raw info.
  • mx7
    mx7 over 10 years
    Ok Now I understood but I think the support of LaTex is missing here right ? catdoc can do that.
  • don.joey
    don.joey over 10 years
    For LaTex you can just use vim. After all that's the goal of LaTex, to type text as is and convert it to publishable text afterwards.
  • mx7
    mx7 over 10 years
    No I mean to say that , If DOC consists of some symbolic things then Latex support we need to view them best . so is this can provide ? becasue Catdoc can provide that
  • don.joey
    don.joey over 10 years
    Symbols you mean? I'd have to check how symbols are transposed in the conversion to a txt file. I think there must be quite some consistency. If you have a document, please try and let us know. The unoconv toolbelt is very advanced.
  • mx7
    mx7 over 10 years
    Yeah I will do that , thanks again for stopping by.