xdg-open command in Linux with Examples

xdg-open command in the Linux system is used to open a file or URL in the user’s preferred application.
The URL will be opened in the user’s preferred web browser if a URL is provided. The file will be opened in the preferred application for files of that type if a file is provided. xdg-open supports ftp, file, https and http URLs. This can be used inside a desktop session only. It is not recommended to use xdg-open as root. Here, the zero is an indication of success while non-zero show the failure.

Syntax:

xdg-open {file | URL}

Example:

xdg-open read.html

Options:

  • xdg-open –version : This option will show the xdg-utils version information.
    xdg-open --version

  • xdg-open –help: This option will show command synopsis.
    xdg-open --help

  • xdg-open –manual: This option will show the manual page.
    xdg-open --manual



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.