xdg-open(1)
Open a file or URL with the user's preferred application.
Synopsis
xdg-open [OPTION]... FILE|URLDescription
xdg-open opens a file or URL in the user's preferred application based on file type or URL scheme. It follows the freedesktop.org specification, automatically detecting whether to use a web browser, document viewer, image viewer, or other handler registered in the desktop environment.
This command respects the user's MIME type associations and default applications configured in their desktop settings (GNOME, KDE, XFCE, etc.), making it the standard way to open files from scripts and command-line tools.
Common options
| Flag | What it does |
|---|---|
--help | Display help message and exit |
--version | Display version information and exit |
Examples
Open a URL in the default web browser
xdg-open https://example.comOpen a PDF file with the default PDF viewer
xdg-open document.pdfOpen an image with the default image viewer (GIMP, Feh, Eye of GNOME, etc.)
xdg-open image.jpgOpen a text file with the default text editor
xdg-open /path/to/file.txtOpen the current directory in the default file manager
xdg-open .Open the default email client with a new message to the specified address
xdg-open mailto:[email protected]Open a Word document in the background without blocking the terminal
xdg-open report.docx &