How to open a file with LibreOffice Writer from Terminal?

Solution 1:

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.

Solution 2:

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.