Ubuntu – Tool for viewing LibreOffice Writer files in terminal window

command linelibreofficetext-editor

I am using a couple of documentation files in LibreOffice (.odt) format. Normally, I access them with LibreOffice Writer of course. But there are times when I can only connect to the site with a text terminal.

I am wondering if there is a terminal-based tool that can show me the contents of these files in approximate correct format? (The files mainly contain simple text, bullet lists, and a few 1×1 tables, so it's relatively simple stuff in terms of formatting.)

P.S. This question is not about starting LibreOffice itself from the command line (which is anwered here).

Best Answer

There is a tool called odt2txt that can convert odt to txt.

Compared to libreoffice I can see two benefits:

  • Lightweight if you don't have libreoffice installed (e.g. on a server)
  • It can print to stdout for direct viewing of files.

Installation:

sudo apt install odt2txt

Then you can directly view an odt:

odt2txt document.odt | less