How to open a file with LibreOffice Writer from Terminal?

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?

asked Aug 10, 2015 at 12:22 user364819 user364819 Nearly a duplicate of askubuntu.com/questions/80977/…. Commented Aug 10, 2015 at 12:28 libreoffice --help @pilot6 answer also works for calc , draw , base Commented Aug 10, 2015 at 12:29 @ParanoidPanda xdg-open? Commented Jul 9, 2017 at 3:18

3 Answers 3

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.

answered Aug 10, 2015 at 12:27 90.9k 94 94 gold badges 219 219 silver badges 326 326 bronze badges Short and powerful =) Commented Aug 10, 2015 at 12:29

If its a csv or xls file then ` libreoffice --calc /path/to/file.csv . You can get more info by man libreoffice`

Commented Nov 18, 2016 at 9:14

To launch a brand new file like this you need to first create it, touch file.odt && libreoffice --writer file.odt

Commented Sep 19, 2017 at 11:06

If you want a new file, there is no need to touch it. You can just start libreoffice --writer then save the file after you edit it.

Commented Sep 19, 2017 at 11:09

For later versions and/or manually-installed versions, you may need to include the version number. In my case, it is required to be done as follows: libreoffice6.1 --writer

Commented Feb 1, 2019 at 18:00

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.