xdg-open — opens a file or URL in the user’s preferred application
Sponsored Link
xdg-open is for use inside a desktop session only. It is not recommended to use xdg-open as root.
Using xdg-open
Syntax
xdg-open { file | URL }
xdg-open Examples
xdg-open ‘http://www.ubuntugeek.com/'
Opens the ubuntugeek.com website in the user's default browser
xdg-open /photos/1.png
Opens the PNG image file /photos/1.png in the user's default image viewing application.
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.
Available options
--help Show command synopsis.
--manual Show this manualpage.
--version Show the xdg-utils version information.
Hmm, how to set the user’s applied app when using non-main-stream DEs, but WMs?
Typo, I meant `the user’s preferred app’.
Any significant difference between xdg-open and gnome-open? Other than “gnome-open” is much easier to remember? (Though it is longer.)
@Victor, the difference may be that a user doesn’t have (or want) GNOME apps. ‘kde-open’ does this same thing and it is shorter, why not use that? Oh because maybe you don’t want KDE apps.
What happens if I type:
xdg-open http://myserver/webdavstuff/nicedoc.odt
Ideally I would open OpenOffice (or whatever is configured for ODT) and hand over the URL. If the http source/destination is webdav it would be read/write
@Victor – xdg-open is a shell script which attempts to call the appropriate ‘open’ utility given the current environment (so if you are using gnome it will call gnome-open).
Hi,
When i use xdg-open ,
it open the file in the default browser say Firefox rather than then Default viewer.
Any help