67

I use LibreOffice Writer a lot, but I really do hate getting around in a GUI, I much prefer the CLI, so is there any way to open a file using LibreOffice Writer through the Terminal?

3 Answers3

84

You can do it by

libreoffice --writer file.odt

If it is an odt file, you can open it just by

libreoffice file.odt

Some file formats can be opened by different LO applications, then you need to specify which one to use.

Pilot6
  • 92,041
5

The more general solution is xdg-open. This not only works for LibreOffice documents, but for any file or URL:

xdg-open file-or-url

opens file-or-url using your preferred application.

If you normally work from the terminal, then having alias o=xdg-open in ~/.bash_aliases makes life simple:

o my-document.odt
o https://askubuntu.com

You may then also enjoy sr (surfraw) for rapid web searches from the command-line.

zwets
  • 12,770
  • 2
  • 37
  • 46
2

In case you need to open a file in LibreOffice in read-only mode it's

libreoffice --view file.odt