XDG-OPEN(1)
โจ NAME โจ
xdg-open โ opens a file or URL in the user's preferred application ๐
okay bestie, so this is the lil man page for xdg-open, from the xdg-utils manual, and it's honestly iconic for one specific reason: it's the vibe-check of "just open this thing the way I like it" ๐ซถ
๐ธ SYNOPSIS ๐ธ
xdg-open {file | URL}
xdg-open {--help | --manual | --version}
๐ฆ DESCRIPTION ๐ฆ
xdg-open opens a file or URL in the user's preferred application. That's literally the whole thing and it ate. ๐ฅ
Hand it a URL? Boom, it opens in your preferred web browser. Hand it a file? It opens in the preferred application for files of that type. xdg-open supports file, ftp, http and https URLs.
โจ Important vibe check:xdg-openis for use inside a desktop session only. And it is not recommended to usexdg-openas root. Like, please don't, bestie ๐ญ
So here's the lil gotcha: xdg-open can not handle arguments that begin with a -, so if you're passing filepaths you should do it one of these ways:
- Pass absolute paths, i.e. by using
realpathas a preprocessor. - Prefix known relative filepaths with a
./. For example usingsed -E 's|^[^/]|./\0|'. - Pass a file URL.
๐ OPTIONS ๐
--helpโ Show command synopsis. (the quick lil "what do I type" moment ๐)--manualโ Show this manual page. (you're soaking in it rn ๐)--versionโ Show the xdg-utils version information. (so you can flex which version you're on โญ)
๐ EXIT CODES ๐
An exit code of 0 indicates success while a non-zero exit code indicates failure. The following failure codes can be returned:
1โ Error in command line syntax.2โ One of the files passed on the command line did not exist.3โ A required tool could not be found.4โ The action failed.
Okay now the tea on success โ In case of success the process launched from the .desktop file will not be forked off and therefore may result in xdg-open running for a very long time. This behaviour intentionally differs from most desktop specific openers to allow terminal based applications to run using the same terminal xdg-open was called from. That's not a bug babes, that's on purpose ๐โจ
๐ REPORTING ISSUES ๐
Please keep in mind xdg-open inherits most of the flaws of its configuration and the underlying opener. (it's giving "not my fault, it's my environment" ๐)
In case the command
xdg-mime query default "$(xdg-mime query filetype path/to/troublesome_file)"
names the program responsible for any unexpected behaviour you can fix that by setting a different handler. (If the program is broken let the developers know ๐)
Also see the security note on xdg-mime(1) for the default subcommand.
If a flaw is reproducible using the desktop specific opener (and isn't a configuration issue): Please report to whoever is responsible for that first (reporting to xdg-utils is better than not reporting at all, but since the xdg-utils are maintained in very little spare time a fix will take much longer ๐ญ)
In case an issue specific to xdg-open please report it to https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues . ๐ซถ
๐ฅ SEE ALSO ๐ฅ
xdg-mime(1)xdg-settings(1)- MIME applications associations specification[1]
๐ EXAMPLES ๐
xdg-open 'http://www.freedesktop.org/'
Opens the freedesktop.org website in the user's default browser. ๐โจ
xdg-open /tmp/foobar.png
Opens the PNG image file /tmp/foobar.png in the user's default image viewing application. ๐ผ๏ธ๐
๐ AUTHORS ๐
- Kevin Krammer โ Author.
- Jeremy White โ Author.
legendary behaviour tbh ๐
๐ COPYRIGHT ๐
Copyright ยฉ 2006
โญ NOTES โญ
- MIME applications associations specification
http://www.freedesktop.org/wiki/Specifications/mime-apps-spec/
and that's the whole thing bestie, slay ๐
โจ this was xdg-utils 1.0, dated 12/06/2025, and yeah the manual page is literally called XDG-OPEN(1) โ iconic, no cap ๐ฆ๐ธ
๐ฆ where this page comes from
- arch rolling: xdg-utils 1.2.1-2 ยท MIT
- ubuntu resolute: xdg-utils 1.2.1-2ubuntu2 ยท MIT
- ubuntu stonking: xdg-utils 1.2.1-2ubuntu2 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms