soffice
Run LibreOffice applications
TLDR
Open one or more files in read-only mode
Display the content of one or more files
Print files using a specific printer
Convert all .doc files in the current directory to PDF
SYNOPSIS
soffice [options] [files...]
soffice --convert-to output_format [:filter_name] [:filter_options] file1 [file2...] [--outdir output_directory]
soffice --print file1 [file2...]
soffice --headless --accept="socket,host=127.0.0.1,port=2002;urp;"
PARAMETERS
--help
Displays help information and exits.
--version
Displays the LibreOffice version and exits.
--writer | --calc | --impress | --draw | --base | --math
Starts LibreOffice with the specified component.
--headless
Runs LibreOffice without a graphical user interface. Essential for server-side processing.
--convert-to <output_format>[:filter_name][:filter_options]
Converts the input files to the specified output format using an optional filter.
--outdir <directory>
Specifies the output directory for converted files.
--print | --pt
Prints the specified documents to the default printer.
--invisible
Starts LibreOffice invisibly (no GUI visible, but process runs). Often used with --accept.
--accept="<connection_string>"
Accepts connections from other processes (e.g., for `unoconv` or programmatic control).
--norestore
Prevents LibreOffice from restoring unsaved documents.
--nofork
Does not fork a new process; keeps `soffice` running in the foreground.
-o
Opens the specified files in read-only mode.
--nologo
Does not show the splash screen at startup.
--view
Opens documents in viewer mode, preventing editing.
--safe-mode
Starts LibreOffice in safe mode, disabling extensions and resetting user profiles.
--terminate_after_init
Exits after initialization, useful for testing startup.
--skip-first-run-wizard
Prevents the first-run wizard from appearing on first launch.
DESCRIPTION
soffice is the main executable for LibreOffice, providing a powerful command-line interface to interact with the office suite without necessarily opening the full graphical user interface. Users can leverage soffice to perform various tasks such as opening documents, converting files between different formats (e.g., DOCX to PDF, ODT to TXT), printing documents, or running LibreOffice in a "headless" (server) mode for batch processing. It supports operations across all LibreOffice components: Writer, Calc, Impress, Draw, Base, and Math, making it a versatile tool for automation, scripting, and server-side document management. Its ability to run without a GUI makes it ideal for integration into workflows on servers or within scripts.
CAVEATS
While powerful, `soffice` has some considerations:
GUI Dependency: Some operations, especially direct opening or printing without --headless, may require an X server or display environment, even if the GUI is not fully displayed.
Memory Usage: Even in headless mode, LibreOffice can consume significant memory, especially when converting large or numerous documents.
Process Management: When running in server modes (e.g., --headless --accept), proper process management and termination are crucial to prevent zombie processes or resource leaks.
Filter Limitations: Not all conversion filters support all features or retain perfect fidelity across complex documents. Testing is recommended for specific conversion needs.
USAGE IN AUTOMATION
The --headless and --convert-to options are particularly useful for scripting and automation. For example, converting a directory full of DOCX files to PDF can be done with a simple shell script iterating through files and calling `soffice --headless --convert-to pdf --outdir /path/to/output_pdfs *.docx`.
SERVER MODE
Running `soffice --headless --invisible --accept="socket,host=127.0.0.1,port=8100;urp;"` allows a single LibreOffice instance to serve multiple conversion requests. This mode is often utilized by applications like `unoconv` or custom services to avoid repeated LibreOffice startup overhead, making batch processing more efficient.
HISTORY
The `soffice` command is the core executable of the LibreOffice suite, which originated as a fork of OpenOffice.org in 2010. OpenOffice.org itself was based on StarOffice, developed by StarDivision and later acquired by Sun Microsystems. The command-line capabilities, including headless operation and document conversion features, have been a foundational part of the suite since its early days, evolving to support new document formats and improve performance. Its robust command-line interface has made it a popular choice for document processing in server environments and automated workflows, continuing its legacy from StarOffice and OpenOffice.org as a versatile, open-source office solution.
SEE ALSO
unoconv(1), libreoffice(1), lp(1), convert(1)