← 返回命令列表

Linux command

libreoffice 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Open a document

libreoffice [path/to/document]

Convert document to PDF

libreoffice --headless --convert-to pdf [document.docx]

Convert to another format

libreoffice --headless --convert-to [xlsx] [spreadsheet.ods]

Convert multiple files

libreoffice --headless --convert-to pdf [*.docx]

Specify output directory

libreoffice --headless --convert-to pdf --outdir [/output] [document.docx]

Start Writer

libreoffice --writer

Start Calc

libreoffice --calc

Start Impress

libreoffice --impress

说明

LibreOffice is a free, open-source office productivity suite including word processor (Writer), spreadsheet (Calc), presentation software (Impress), drawing application (Draw), formula editor (Math), and database manager (Base). The command line enables powerful automation. The --headless mode runs without GUI, essential for server-side document conversion. Combined with --convert-to, it can batch-convert documents between formats - commonly used for generating PDFs from various office documents. Conversion supports filters for fine-tuned output. Format:filter syntax (e.g., csv:Text - txt - csv (StarCalc)) allows specifying exact export options. Available filters depend on installed components. For scripting, LibreOffice supports macros in Basic, Python, JavaScript, and BeanShell. The UNO API provides programmatic document manipulation. Combined with headless mode, this enables document generation pipelines. The quickstarter feature keeps LibreOffice partially loaded for faster document opening, useful on systems where it's frequently used.

参数

--headless
Run without GUI (for conversion/scripting).
--convert-to _format:filter_
Convert to specified format and exit.
--outdir _path_
Output directory for converted files.
--writer
Open LibreOffice Writer.
--calc
Open LibreOffice Calc.
--impress
Open LibreOffice Impress.
--draw
Open LibreOffice Draw.
--math
Open LibreOffice Math.
--base
Open LibreOffice Base.
--print-to-file _file_
Print to file instead of printer.
--infilter _filter_
Force input filter.
-n, --new
Open new empty document.
-o, --view
Open in read-only mode.
--safe-mode
Start in safe mode (disabled extensions).
--nofirststartwizard
Skip first-start wizard.
--quickstart
Enable quickstarter.
--terminate_after_init
Exit after loading (for testing).
--norestore
Disable automatic crash recovery.
--nologo
Suppress the splash screen on startup.
--nolockcheck
Disable checks for remote running instances.
--invisible
Start without any UI (no window, no tray icon).
--cat _file_
Dump document text content to standard output, then exit.
-p _file..._
Print the given files to the default printer and exit.
--pt _printer_ _file..._
Print to the named printer and exit.

FAQ

What is the libreoffice command used for?

LibreOffice is a free, open-source office productivity suite including word processor (Writer), spreadsheet (Calc), presentation software (Impress), drawing application (Draw), formula editor (Math), and database manager (Base). The command line enables powerful automation. The --headless mode runs without GUI, essential for server-side document conversion. Combined with --convert-to, it can batch-convert documents between formats - commonly used for generating PDFs from various office documents. Conversion supports filters for fine-tuned output. Format:filter syntax (e.g., csv:Text - txt - csv (StarCalc)) allows specifying exact export options. Available filters depend on installed components. For scripting, LibreOffice supports macros in Basic, Python, JavaScript, and BeanShell. The UNO API provides programmatic document manipulation. Combined with headless mode, this enables document generation pipelines. The quickstarter feature keeps LibreOffice partially loaded for faster document opening, useful on systems where it's frequently used.

How do I run a basic libreoffice example?

Run `libreoffice [path/to/document]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --headless do in libreoffice?

Run without GUI (for conversion/scripting).