How to Read OpenOffice / LibreOffice Files from the Command Line

Let’s say you have edited a file in LibreOffice Writer, but later you access your computer remotely via SSH for example. You don’t really want to bother copying the file to your current machine, and rather just quickly check its content in the terminal. Is there a way?

Since odt files are just some zip files containing XML files, you could manually decompress the file, and open XML files, but there is a more convenient the program is called odt2txt. On an Ubuntu / Debian machine it can be installed with:

For basic usage, you just need to pass the filename as parameter:

But there are also a few more options:

This also wrote with ods (spreadsheets) and odp (presentations) files with ods2txt and odp2txt which are just symlinks pointing to the same program as odt2txt, namely odt2txt.odt2txt.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

2 Replies to “How to Read OpenOffice / LibreOffice Files from the Command Line”

  1. Openoffice has a headless mode too – not sure exactly what you can do with it:
    $ soffice –help
    LibreOffice 420m0(Build:2)

    Usage: soffice [options] [documents…]

    –minimized keep startup bitmap minimized.
    –invisible no startup screen, no default document and no UI.
    –norestore suppress restart/restore after fatal errors.
    –quickstart starts the quickstart service
    –nologo don’t show startup screen.
    –nolockcheck don’t check for remote instances using the installation
    –nodefault don’t start with an empty document
    –headless like invisible but no userinteraction at all.
    –help/-h/-? show this message and exit.
    –version display the version information.
    –writer create new text document.
    –calc create new spreadsheet document.
    –draw create new drawing.
    –impress create new presentation.
    –base create new database.
    –math create new formula.
    –global create new global document.
    –web create new HTML document.
    -o open documents regardless whether they are templates or not.
    -n always open documents as new files (use as template).

    Specify X-Display to use in Unix/X11 versions.
    print the specified documents on the default printer.
    print the specified documents on the specified printer.
    open the specified documents in viewer-(readonly-)mode.
    open the specified presentation and start it immediately
    Specify an UNO connect-string to create an UNO acceptor through which
    other programs can connect to access the API
    Close an acceptor that was created with –accept=
    Use –unnaccept=all to close all open acceptors
    Force an input filter type if possible
    Eg. –infilter=”Calc Office Open XML”
    –convert-to output_file_extension[:output_filter_name] [–outdir output_dir] files
    Batch convert files.
    If –outdir is not specified then current working dir is used as output_dir.
    Eg. –convert-to pdf *.doc
    –convert-to pdf:writer_pdf_Export –outdir /home/user *.doc
    –print-to-file [-printer-name printer_name] [–outdir output_dir] files
    Batch print files to file.
    If –outdir is not specified then current working dir is used as output_dir.
    Eg. –print-to-file *.doc
    –print-to-file –printer-name nasty_lowres_printer –outdir /home/user *.doc
    –pidfile file
    Store soffice.bin pid to file.

    Remaining arguments will be treated as filenames or URLs of documents to open.

Leave a Reply

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

Khadas VIM4 SBC
Khadas VIM4 SBC