Linux Commands Examples

A great documentation place for Linux commands


Sorry, no description

... the author of this command may not have provided any manuals

Once you know what this command is about, feel free to add a description in the input "add an example + trick and tips" below
 help other Linux-fans !


libreoffice [--accept=accept-string] [--base] [--calc] [--convert-to output_file_extension[:output_filter_name] [--outdir output_dir] file]... [--display display] [--draw] [--global] [--headless] [--help|-h|-?] [--impress] [--invisible] [--infilter="<filter>"] [--math] [--minimized] [-n file]... [--nodefault] [--nolockcheck] [--nologo] [--norestore] [-o file]... [-p file...] [--print-to-file [--printer-name printer_name] [--outdir output_dir] file]... [--pt printername file...] [--show Impress file]... [--unaccept=accept-string] [--terminate_after_init] [--view file]... [--web] [--writer] [file...]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



Converting Open Office (odt) files to Latex

OpenOffice used to have a LaTeX export functionality, which was later removed, I guess. Nevertheless, there is a LaTeX writer:

sudo apt-get install writer2latex

Or, if your distribution uses LibreOffice, use libreoffice-writer2latex instead of the above.

Just confirm all messages with y. After installing, you can use it with w2l

w2l your-document.odt

which will create a .tex file with the same name. The formatting is pretty basic, but I think it gets the job done.

If you wish to edit it in Lyx after that, just concatenate the commands, something like that:

w2l your-document.odt && /usr/bin/env lyx your-document.tex &

I tested the conversion on Ubuntu 11.04 with the default LibreOffice installation


Printing from the command line with LibreOffice, lpr commands?

You can't pass lpr command line options to libreoffice. Two possible solutions are:

  1. One step solution (the best solution in my opinion): use unoconv outputting a PDF to stdout piped to lpr:

    $ unoconv --stdout filename.doc | lpr -U username -P the_printer_name
  2. Three step solution (if you don't want / can't use unoconv): use libreoffice --print-to-file to a temporary file + lpr of the file + delete the temporary file (unfortunatelly libreoffice still doesn't support printing to stdout):

    $ libreoffice --headless --print-to-file --printer-name the_printer_name --outdir /tmp filename.doc
    $ lpr -U username /tmp/ -P the_printer_name
    $ rm /tmp/

Effect of HOME on libreoffice to convert to pdf as non-root user

I have really no idea what you are trying to do here.

  • $HOME is your user's home directory, why would you change that to run a program?

  • You are explicitly telling libreoffice to create a pdf in the directory /tmp/ayb which does not seem to be your current directory. You are then attempting to delete a pdf from your current directory and, of course, it does not exist because you have told it to place it in /tmp/ayb.

What happens if you do not change HOME or your user or anything else and just run:

$ libreoffice --headless -convert-to pdf --outdir /tmp/ayb /tmp/ayb/document_34.doc
$ ls /tmp/ayb/d*.pdf
exec libreoffice "$@"
silent /usr/bin/libreoffice "$@"

Exporting vector graphics from Inskcape into Libreoffice

Exporting from Inkscape using the png image format which Libreoffice fully supports, rather than saving in vectorial format which it does not support, is actually the only option.

See in Inkscape Wiki : Save as vs export.

However, the thread How to import SVG in OOo Writer says :

The svg import will be new feature in OOo 3.4, try OOo 3.4 beta from OOo download site.

This is about OpenOffice, of which Libreoffice is actually another branch.
You might consider changing because of this feature, until it finds its way into Libreoffice.


Only root User is able to open LibreOffice

It looks like your username is not identified by linux to have enough privilege to run commands. A few things you should check like:

Make sure you are in sudo group with this command.

$ getent group sudo

It should show output as sudo:x:27:fayad

If you are not in it add the username with

$ sudo gpasswd -a <user> sudo

Crosscheck your /etc/sudoers by opening the file and confirming it has the following lines.

# Allow members of group sudo to execute any command



How to prevent LibreOffice running 'recover' at each startup?

Adding the option '--norestore' when running libreoffice gets rid of the recovery dialog.

This can be made to happen systematically by adding the following to your .bashrc:

alias libreoffice="libreoffice --norestore"

System-wide auto-complete word list syncing/integration?

I assume you are referring to LibreOffice's auto-complete feature.

The closest I found is the english typing booster, which is a new feature in Fedora 17.

You need to compile it yourself though, if you want to use it with anything but F17.


Are there Linux utilities for previewing files (partic. .doc's) rather than full-blown editing?

This is something that antiword was designed for.

You can convert MSW documents into plain text, PDF, PostScript, and DocBook, depending on which reader you prefer to view files in.


sandboxing libreoffice on Linux

What I've done on my CentOS (Redhat/RPM based distro) box:

  1. Download the RPMs. Store to a temp dir.
  2. Create a directory where the programs will live.
  3. Extract the files to the directory. For an rpm
    • for FILE in /tmp/dir/*.rpm ; do rpm2cpio $FILE | cpio -iv --make-directories
  4. Find the "base" dir for the executable:
    • find /path/to/install/dir -name soffice -type f | xargs dirname
  5. set PATH to include above directory.

For Debian, I'd substitute step 3. with something like:

for FILE in /tmp/dir/*.rpm ; do dpkg-deb -X $FILE ; done

But I don't have a debian based distro to confirm that the layouts are what I'd expect. I'd also look at dpkg-deb --fsys-tarfile archive $FILE | tar -xvf - if dpkg-deb -X doesn't work.


Convert file to PDF using LibreOffice under user apache (i.e. when using PHP)

There are two problems here. The first is that www-data (the apache user) does not have a $HOME so libreoffice cannot run if there is no $HOME defined. The second problem is, unless you specifically set it up this way (and you really really really shouldn't), apache does not have access to the system /tmp directory. A web server normally runs in a restricted environment and does not have full access to the file system for very valid security reasons.

So, you need to i) give apache's user a home and ii) give it a directory it has access to to write in. So, create a tmp directory in the same folder where you store your webpage and then run the following php code:

  shell_exec('export HOME=/tmp && libreoffice --headless -convert-to pdf --outdir ./tmp /tmp/ayb/document_34.doc');

I just tested and it works perfectly on my machine. Make sure your ./tmp has its permissions set to 777. Also, you may need to restart apache if you play aroud with it too much. It stopped working for me after a while when I made changes and I needed to restart it.


How to fix X11 error: Can't open display

If you are going headless, then you shouldn't need X. See Convert file to PDF using LibreOffice under user apache (i.e. when using PHP) for a working solution.


Libreoffice readonly document with one specified name

I would check if there is a lock file for the file you are trying to save. Enable showing hidden files in your file browser or do a ls -la in a terminal window and look for a file like ".~lock.??? ????? 1.odt#". If one is present, make sure you close all LibreOffice windows and delete it with your file browser or rm.

These files can get left behind if LibreOffice isn't closed properly.


How to make Libreoffice integrate better with KDE graphic environment

In order to better integrate Libreoffice's interface with KDE, you must remove the libreoffice-kde package; it is supposed to provide the required integration, but apparently it doesn't do its job very well.

Then you should install the libreoffice-gtk package, you should get the following result:

enter image description here

I've tried this with Kubuntu, I'm not sure if it works also with other KDE distros but I suppose that is should.


LibreOffice (LO for short) is a multi-platform office productivity suite. It was derived from 3.3 Beta on September 28, 2010.

libreoffice is a shell script that sets up the environment and passes the command line arguments to the soffice.bin binary.

Alternatively, the following helper scripts start the respective module:

sbase, scalc, sdraw, simpress, smath, sofficerc, spadmin, swriter



Specify a UNO connect-string to create a UNO acceptor through which other programs can connect to access the API.


Starts the wizard for a new Base document.


Starts with a new Calc document.

--convert-to output_file_extension[:output_filter_name] [--outdir
output_dir] file...

Batch converts files. If --outdir is not specified then the current working directory is used as the output directory for the converted files.


--convert-to pdf *.doc

Converts all .doc files to PDFs.

--convert-to pdf:writer_pdf_Export --outdir /home/user *.doc

Converts all .doc files to PDFs using the settings in the Writer PDF export dialog and saving them in /home/user.

--display display

This option specifies the X server to use; see X(7)


Starts with a new Draw document.


Starts with a new Global document.


Starts in "headless mode", which allows using the application without user a interface.

This special mode can be used when the application is controlled by external clients via the API.

It implies --invisible and strictly ignores any GUI environment. --quickstart does not work with this parameter.


Lists LibreOffice command line parameters.


Starts with a new Impress document.


Starts in invisible mode.

Neither the start-up logo nor the initial program window will be visible. LO can be controlled and documents and dialogs can be opened via the API.

When started with this parameter, it can only be quit using the taskmanager (Windows) or the kill command (UNIX based systems).

--quickstart does not work with this parameter.


Force an input filter type if possible. For example -infilter="Calc Office Open XML" only


Starts with a new Math document.


Keeps the splash screen minimized.

-n template...

Creates the a new document from the given templates.


Starts LO without creating a new document. The next time you start LO, the welcome screen is shown.

It’s used together with --nologo by quick starters. Note that --quickstart has no longer been supported since 2.0.0.


Disables the check for remote instances using the installation.


Disables the splash screen at program start.


Disables restart and file recovery after a system crash. It is possible that LO will try to restore a file it keeps crashing on, if that happens --norestore is the only way to start LO.


Disables the splash screen at program start.

-o file...

Opens the given files for editing, even templates.

Without -o a template file would create a new document derived from that template.

-p file...

Prints the given files to the default printer and ends. The splash screen does not appear.

If the file name contains spaces, then it must be enclosed in quotation marks.

--print-to-file [--printer-name printer_name] [--outdir output_dir]

Batch print files to file. If --printer-name is not specified the default printer is used. If --outdir is not specified then the current working directory is used as the output directory for the converted files.


--print-to-file *.doc

Prints all .doc files to the current working directory using the default printer.

--print-to-file --printer-name nasty_lowres_printer --outdir /home/user *.doc

Prints all .doc files to /home/user directory using the nasty_lowres_printer.

--pt printername file...

Prints the given files to the printer printername and ends. The splash screen does not appear.

If a file name contains spaces, then it must be enclosed in quotation marks.

--quickstart --quickstart=no

Starts LO with it’s quick starter. --quickstart disable the quick starter.

Does not work with --invisible or --headless.

--show Impress file...

Opens the given Impress files, starts the presentation and quits after they have finished.


Closes an acceptor that was created with --accept option.

Use --unaccept=all to close all open acceptors.


Starts LO and terminates after it registers some UNO services. Doesn’t show the splash during startup.

--view file...

Opens the given files read-only creating a temporary copy of them at $TMPDIR.


Starts with a new HTML document.


Starts with a new Writer document.

troubleshooting problems

See for more details on how to report bugs in LibreOffice.

see also


This manual page was created by Rene Engelhard <rene[:at:]debian[:dot:]org> for the Debian GNU/Linux Distribution, because the original package does not have one. It was updated for Novell by Petr Mladek <petr.mladek[:at:]novell[:dot:]com> and adapted for LibreOffice by Philipp Weissenbacher <philipp.weissenbacher[:at:]gmail[:dot:]com>.

How can this site be more helpful to YOU ?

give  feedback